intdgesvd.c File Reference

#include "stack-c.h"

Include dependency graph for intdgesvd.c:

Go to the source code of this file.

Defines

#define MAX(x, y)   (((x)>(y))?(x):(y))
#define MIN(x, y)   (((x)<(y))?(x):(y))

Functions

int intdgesvd (char *fname)


Define Documentation

#define MAX ( x,
y   )     (((x)>(y))?(x):(y))

Definition at line 9 of file intdgesvd.c.

#define MIN ( x,
y   )     (((x)<(y))?(x):(y))

Definition at line 10 of file intdgesvd.c.


Function Documentation

int intdgesvd ( char*  fname  ) 

Definition at line 12 of file intdgesvd.c.

References C2F, CheckLhs, CheckRhs, CreateVar, Error, GetRhsVar, Lhs, LhsVar, ls, lw, M, MAX, Maxvol, MIN, N, Rhs, s, sciprint(), stk, and WORK.

00014 { 
00015   int M,N,lA;
00016   int NRHS, NLHS;
00017   int mU, nU, lU, U;
00018   int mVT, nVT, lVT, VT;
00019   int ls, ns, s;
00020   int un=1; int WORK, LWORKMIN, LWORK, lw, INFO;
00021   int LDA, LDU, LDVT;
00022 
00023   CheckRhs(1,1) ;  CheckLhs(3,3) ;
00024 
00025   /*--------------------A---------------------------*/
00026   GetRhsVar(1, "d", &M, &N, &lA);
00027 
00028   NRHS=Rhs; NLHS=Lhs;
00029   switch ( NLHS ) {
00030   case 3:        /*  [U,s,VT]=svd(A)     */
00031   /*--------------------U---------------------------*/
00032     mU=M; nU=M;
00033     U=NRHS+1;
00034     CreateVar(U, "d", &mU, &nU, &lU);   /* U */
00035   /*--------------------s---------------------------*/
00036     ns=M; if (M>N) ns=N;
00037     s=NRHS+2;
00038     CreateVar(s, "d", &un, &ns, &ls);    /* s  */
00039   /*--------------------VT---------------------------*/
00040     mVT=N; nVT=N;
00041     VT=NRHS+3;
00042     CreateVar(VT, "d", &mVT, &nVT, &lVT);   /* VT */
00043   /*--------------------WORK---------------------------*/
00044     WORK=NRHS+4;
00045     LWORK=Maxvol(WORK, "d");  /*  max memory currently available */
00046     LWORKMIN = MAX(3*MIN(M,N)+MAX(M,N),5*MIN(M,N)-4);
00047     if (LWORK < LWORKMIN) { sciprint("not enough memory (use stacksize)");
00048        Error(9999); };
00049     CreateVar(NRHS+4, "d", &LWORK, &un, &lw);   /* WORK */
00050     LDA=M; LDU=M; LDVT=N;
00051 
00052     C2F(dgesvd)("A", "A", &M, &N, stk(lA), &LDA, stk(ls), stk(lU), &LDU, stk(lVT), &LDVT, stk(lw), &LWORK, &INFO);
00053 
00054     LhsVar(1)=U; LhsVar(2)=s; LhsVar(3)=VT;
00055     break;
00056   case 2:
00057     /*   [U,s]=svd(A)  To be done  */
00058     break;
00059   case 1:
00060     /*    s=svd(A) To be done  */
00061     break;
00062   default:
00063     return 0;
00064  }
00065   return(0);
00066 }

Here is the call graph for this function:


Generated on Sun Mar 4 16:09:44 2007 for Scilab [trunk] by  doxygen 1.5.1