MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Compiling SingularValueDecomposition

  • To: mathgroup at
  • Subject: [mg89809] Compiling SingularValueDecomposition
  • From: Frank Hu <frank1998 at>
  • Date: Sat, 21 Jun 2008 05:30:09 -0400 (EDT)

Hi, group,

I'm trying to speed up a piece of code that uses  
SingularValueDecomposition by compiling it.  But I couldn't get it to  
compile.  For a simple demonstration, try

fx=Compile[{{x, _Real, 2}},  SingularValueDecomposition[x],  
{{SingularValueDecomposition, _Real, 3}}]

and fx[[4]] is
{{1, 5}, {54, Function[{x}, SingularValueDecomposition[x]], 3, 2, 0,  
3, 2, 1}, {2}}

The "Function" there tells fx wasn't compiled successfully.  Calling  
fx[{{1., 2.}, {3., 4.}}] will generate the following warnings

CompiledFunction::cfte: Compiled expression {<<1>>} should be a rank  
2 tensor of machine-size real numbers. >>
CompiledFunction::cfex: Could not complete external evaluation at  
instruction 2; proceeding with uncompiled evaluation. >>

Any suggestions?


  • Prev by Date: Export a matrix in C form
  • Next by Date: Re: WorldPlot and excel data
  • Previous by thread: Re: Export a matrix in C form
  • Next by thread: Re: Compiling SingularValueDecomposition