ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
dmat42.cpp File Reference

(Last Changed on November 12, 2014 for git-revision 04062068f9a30906e5f161d2b15800be97dad8be.)

This file deals with the Singular Value Decomposition of a matrix. More...

#include <fvar.hpp>

Go to the source code of this file.

Macros

#define SIGN(a, b)   ((b) >= 0.0 ? fabs(a) : -fabs(a))
 

Functions

sing_val_decomp singval_decomp (const dmatrix &_a)
 Singular value decomposition. More...
 
int svd (int m, int n, int withu, int withv, double eps, double tol, const dmatrix &aa, const dvector &_q, const dmatrix &_u, const dmatrix &_v)
 Singular value decomposition. More...
 
int svd_mln (int m, int n, int withu, int withv, double eps, double tol, const dmatrix &aa, const dvector &_q, const dmatrix &_u, const dmatrix &_v)
 Singular value decomposition. More...
 
int svd_nlm (int m, int n, int withu, int withv, double eps, double tol, const dmatrix &aa, const dvector &_q, const dmatrix &_u, const dmatrix &_v)
 Singular value decomposition. More...
 

Detailed Description

This file deals with the Singular Value Decomposition of a matrix.

The format of the decomposition follows the format given in "Numerical Recipes in C", 2nd edition, Press, Teukolsky, Vetterling, Flannery, section 2.6.

Definition in file dmat42.cpp.

Macro Definition Documentation

#define SIGN (   a,
 
)    ((b) >= 0.0 ? fabs(a) : -fabs(a))

Definition at line 20 of file dmat42.cpp.

Referenced by get_eigen(), and get_eigen_values().

Function Documentation

sing_val_decomp singval_decomp ( const dmatrix _a)

Singular value decomposition.

param _a

Definition at line 71 of file dmat42.cpp.

int svd ( int  m,
int  n,
int  withu,
int  withv,
double  eps,
double  tol,
const dmatrix aa,
const dvector _q,
const dmatrix _u,
const dmatrix _v 
)

Singular value decomposition.

Parameters
m$m$ the number of rows of $A$
n$n$ the number of columns of $A$
withutrue if the $U$-part is wanted (true=1, false=0)
withvtrue if the $V$-part is wanted (true=1, false=0)
epsi.e Epsilon
tolthe tolerance used
aa$A$
_q$q$
_u$U$
_v$V$
Returns
an error code = 0, if no errors and 'k' if a failure to converge at the 'kth' singular value.

On return $q$ will contain the singular values of $A$ and $U$ and $V$ will be a column-orthogonal matrices so that $A = U\cdot\mbox{diag(q)}\cdot V^{T} $

Definition at line 118 of file dmat42.cpp.

Referenced by singval_decomp().

int svd_mln ( int  m,
int  n,
int  withu,
int  withv,
double  eps,
double  tol,
const dmatrix aa,
const dvector _q,
const dmatrix _u,
const dmatrix _v 
)

Singular value decomposition.

Used to find the svd of a matrix when $m<n$.



Modified from svd.c (http://www.crbond.com/download/misc/svd.c), an algorithm that was translated by C. Bond to 'C' from the original Algol code in "Handbook for Automatic Computation, vol. II, Linear Algebra", Springer-Verlag.

Definition at line 170 of file dmat42.cpp.

Referenced by svd().

int svd_nlm ( int  m,
int  n,
int  withu,
int  withv,
double  eps,
double  tol,
const dmatrix aa,
const dvector _q,
const dmatrix _u,
const dmatrix _v 
)

Singular value decomposition.

Used to find the svd of a matrix when $m\ge n$.



Modified from svd.c (http://www.crbond.com/download/misc/svd.c), an algorithm that was translated by C. Bond to 'C' from the original Algol code in "Handbook for Automatic Computation, vol. II, Linear Algebra", Springer-Verlag.

Definition at line 451 of file dmat42.cpp.

Referenced by svd().