~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/math/matrix/mat_invsd.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)Inverse SVD
  2 **/
  3 
  4 #include <stdio.h>
  5 #include <math.h>
  6 #include <tina/sys.h>
  7 #include <tina/math.h>
  8 #include <tina/mathfuncs.h>
  9 
 10 Matrix *matrix_invsvd(Matrix * a, double condition)
 11 {
 12     Matrix *matinv;
 13     Matrix *v = NULL;
 14     Matrix *d;
 15     Matrix *vd;
 16     Matrix *ut;
 17     Matrix *u = NULL;
 18     double *w = NULL;
 19     int     i;
 20 
 21     if (a == NULL)
 22         return (NULL);
 23 
 24     matrix_svd(a, &u, &v, &w, condition);
 25     d = matrix_alloc(a->n, a->n, matrix_full, double_v);
 26     for (i = 0; i < a->n; i++)
 27         if (w[i])
 28             d->el.double_v[i][i] = 1.0 / w[i];
 29     ut = matrix_transp(u);
 30     vd = matrix_prod(v,d);
 31     matinv = matrix_prod(vd, ut);
 32 
 33     matrix_free((Matrix *) v);
 34     matrix_free((Matrix *) d);
 35     matrix_free((Matrix *) vd);
 36     matrix_free((Matrix *) u);
 37     matrix_free((Matrix *) ut);
 38     return (matinv);
 39 }
 40 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.