Message Boards Message Boards

3 Replies
4 Total Likes
View groups...
Share this post:

Problem with LAPACK library compiling

Posted 11 years ago
Dear All, 

when i want to use a LAPACK function in my code i get the error, please help
 function SVDRLS
   import Modelica.Math.Matrices;
   input Real A[3,2];
   output Real sigmasvd[3,2];
   output Real Usvd[3,3];
   output Real VTsvd[2,2];
 end SVDRLS;

Error: Tuple assignment only allowed when rhs is function call (in Matrices.singularValues(A))
POSTED BY: Salman Zaffar
3 Replies
@Zaffer, I created this discussion about calling lapack subroutines. This is dedicated to the QR decomposition, yet the C code in this thread can have fairly generic application. You may want to take a look.  
POSTED BY: Shenghui Yang
There was a typo in the example file of SingularValue. You can create a new function with the following code. The only change I made is to move "info" to output and outside the protected scope. 
 function mysingularValues "Compute singular values and left and right singular vectors" 
   extends Modelica.Icons.Function;
   input Real A[:,:] "Matrix";
   output Real sigma[min(size(A, 1), size(A, 2))] "Singular values";
   output Real U[size(A, 1),size(A, 1)]=identity(size(A, 1)) "Left orthogonal matrix";
   output Real VT[size(A, 2),size(A, 2)]=identity(size(A, 2)) "Transposed right orthogonal matrix ";
   output Integer info;
   Integer n=min(size(A, 1), size(A, 2)) "Number of singular values";
  if n > 0 then
    assert(info == 0, "The numerical algorithm to compute the
singular value decomposition did not converge");
  end if;
end mysingularValues;
And the following sample model should give you a correct result:
 model test
   Real q[2,2]={{1,3},{9,8}};
   Real a[2];
   Real b[2,2];
   Real c[2,2];
   Integer d;
 end test;

POSTED BY: Shenghui Yang
Thank you for bringing this to our attention. We will look into this.
POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract