Assignments
Assignments
SVD.inl File Reference
#include <stdio.h>
#include <memory.h>
#include <malloc.h>
#include <math.h>

Go to the source code of this file.

Macros

#define MIN(A, B)   (((A)<(B)) ? (A):(B))
 
#define MAX(A, B)   (((A)>(B)) ? (A):(B))
 
#define ALLOC2D(m, n)   (REAL *) malloc((unsigned)(m)*(n)*sizeof(REAL))
 
#define ALLOC1D(n)   (REAL *) malloc((unsigned)(n)*sizeof(REAL))
 
#define FREE(p)   free((char*)(p))
 
#define CLEAR2D(a, m, n)   (void) memset((char*)(a),0,(m)*(n)*sizeof(REAL))
 
#define COPY2D(d, m, n, s)   (void) memcpy((char*)(d),(char*)(s),(int)((m)*(n)*sizeof(REAL)))
 
#define REF2D(a, m, n, i, j)   (a[(n)*(i)+(j)])
 

Functions

template<class REAL >
REAL fhypot (REAL a, REAL b)
 
template<class REAL >
void householder_zero_col (REAL *a, REAL *u, int i, int j, int m, int n, REAL *hv)
 
template<class REAL >
void householder_zero_row (REAL *a, REAL *v, int i, int j, int m, int n, REAL *hv)
 
template<class REAL >
void rotate_cols (int i, int j, REAL cos, REAL sin, REAL *a, int start, int n, int mm, int nn)
 
template<class REAL >
void rotate_rows (int i, int j, REAL cos, REAL sin, REAL *a, int start, int n, int mm, int nn)
 
template<class REAL >
void clr_top_supdiag_elt (REAL *b, int p, int z, REAL *u, int m, int n, int min)
 
template<class REAL >
void clr_bot_supdiag_elt (REAL *b, int p, int z, REAL *v, int m, int n, int min)
 
template<class REAL >
void clr_top_subdiag_elt (REAL *b, int p, int z, REAL *u, REAL *v, int m, int n, int min)
 
template<class REAL >
void golub_kahn_svd_rot (REAL *b, int p, int q, REAL *v, int m, int n, int min)
 
template<class REAL >
void bidiagonalize (const REAL *a, int m, int n, REAL *u, REAL *b, REAL *v)
 
template<class REAL >
void bidiagonal_svd (REAL *b, int m, int n, REAL *u, REAL *v)
 
template<class REAL >
void num_svd (const REAL *a, int m, int n, REAL *u, REAL *w, REAL *vt)
 
template<class REAL >
void num_svd_backsubst (int m, int n, const REAL *u, const REAL *w, const REAL *vt, const REAL b[], REAL x[], REAL eps)
 

Macro Definition Documentation

◆ ALLOC1D

#define ALLOC1D ( n)    (REAL *) malloc((unsigned)(n)*sizeof(REAL))

◆ ALLOC2D

#define ALLOC2D ( m,
n )   (REAL *) malloc((unsigned)(m)*(n)*sizeof(REAL))

◆ CLEAR2D

#define CLEAR2D ( a,
m,
n )   (void) memset((char*)(a),0,(m)*(n)*sizeof(REAL))

◆ COPY2D

#define COPY2D ( d,
m,
n,
s )   (void) memcpy((char*)(d),(char*)(s),(int)((m)*(n)*sizeof(REAL)))

◆ FREE

#define FREE ( p)    free((char*)(p))

◆ MAX

#define MAX ( A,
B )   (((A)>(B)) ? (A):(B))

◆ MIN

#define MIN ( A,
B )   (((A)<(B)) ? (A):(B))

◆ REF2D

#define REF2D ( a,
m,
n,
i,
j )   (a[(n)*(i)+(j)])

Function Documentation

◆ bidiagonal_svd()

template<class REAL >
void bidiagonal_svd ( REAL * b,
int m,
int n,
REAL * u,
REAL * v )

if (iter>=30)

◆ bidiagonalize()

template<class REAL >
void bidiagonalize ( const REAL * a,
int m,
int n,
REAL * u,
REAL * b,
REAL * v )

◆ clr_bot_supdiag_elt()

template<class REAL >
void clr_bot_supdiag_elt ( REAL * b,
int p,
int z,
REAL * v,
int m,
int n,
int min )

◆ clr_top_subdiag_elt()

template<class REAL >
void clr_top_subdiag_elt ( REAL * b,
int p,
int z,
REAL * u,
REAL * v,
int m,
int n,
int min )

◆ clr_top_supdiag_elt()

template<class REAL >
void clr_top_supdiag_elt ( REAL * b,
int p,
int z,
REAL * u,
int m,
int n,
int min )

◆ fhypot()

template<class REAL >
REAL fhypot ( REAL a,
REAL b )

◆ golub_kahn_svd_rot()

template<class REAL >
void golub_kahn_svd_rot ( REAL * b,
int p,
int q,
REAL * v,
int m,
int n,
int min )

◆ householder_zero_col()

template<class REAL >
void householder_zero_col ( REAL * a,
REAL * u,
int i,
int j,
int m,
int n,
REAL * hv )

◆ householder_zero_row()

template<class REAL >
void householder_zero_row ( REAL * a,
REAL * v,
int i,
int j,
int m,
int n,
REAL * hv )

◆ num_svd()

template<class REAL >
void num_svd ( const REAL * a,
int m,
int n,
REAL * u,
REAL * w,
REAL * vt )

◆ num_svd_backsubst()

template<class REAL >
void num_svd_backsubst ( int m,
int n,
const REAL * u,
const REAL * w,
const REAL * vt,
const REAL b[],
REAL x[],
REAL eps )

◆ rotate_cols()

template<class REAL >
void rotate_cols ( int i,
int j,
REAL cos,
REAL sin,
REAL * a,
int start,
int n,
int mm,
int nn )

◆ rotate_rows()

template<class REAL >
void rotate_rows ( int i,
int j,
REAL cos,
REAL sin,
REAL * a,
int start,
int n,
int mm,
int nn )