Question: Problem with codegeneration[Fortran] and Vectors of functions!!!!!

Hi to everybody. I have to create a fortran output a lot of time for different polinomials.and CodeGeneration gives me an error. i give you a simple example to understand my problem:

restart;


  with(LinearAlgebra):


 with(CodeGeneration):


 np:=10;


 basex := Vector(np):


 for i from 1 to np do


    basex[i] := unapply(x^(i-1)-1,x);


 od:


 Fortran(basex(x),optimize,deducetypes=false,defaulttype=numeric);



 

It gives me this error: Error, (in codegen/optimize/prepro) too many levels of recursion
 

if instead i had written basex :=vector(np) and using 
fortran instead of Fortran:


restart;
  with(linalg):
  with(codegen):
   np:=10;
  basex := vector(np);
  for i from 1 to np do
     basex[i] := unapply(x^(i-1)-1,x);
  od:
  fortran( basex(x),optimized,mode=double);


does not give me the double precision!It gives me everything as integers! Finally if i use vector and Fortran:

 

restart;
  with(LinearAlgebra):
   with(CodeGeneration):
   np:=10;
  basex := vector(np);
  for i from 1 to np do
     basex[i] := unapply(x^(i-1)-1,x);
  od:
Fortran(basex(x),deducetypes=false,defaulttype=numeric);

it is not bad, it has the dobleprecision, but It gives me only the non-zero element of a Vector!! but I want all the elements!!this is important for my since in my cases i have usually a lot of non zero elements so i need to print them!

 

do you have suggestions?thanks so much
alberto

 

Please Wait...