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

(Last Changed on August 06, 2022 for git-revision d6c67e9794bde1289c87a3fd5fc7b81bbfb34cbb.)

#include <fvar.hpp>
#include "hs.h"

Go to the source code of this file.

Macros

#define USE_ADJOINT_CODE
 
#define XCONST   const
 

Functions

int allocated (const dcompressed_triplet &_st)
 
int allocated (const dvar_compressed_triplet &_st)
 
int chol (XCONST hs_smatrix &A, XCONST hs_symbolic &T, hs_smatrix &L)
 
int chol (XCONST dvar_hs_smatrix &AA, XCONST hs_symbolic &T, dvar_hs_smatrix &LL)
 
int cholnew (XCONST hs_smatrix &A, XCONST hs_symbolic &S, hs_smatrix &L)
 
hs_smatrix cs_add (XCONST hs_smatrix &AA, XCONST hs_smatrix &BB, double alpha, double beta)
 
dvar_hs_smatrix cs_add (XCONST dvar_hs_smatrix &AA, XCONST dvar_hs_smatrix &BB, double alpha, double beta)
 
ivector cs_amd (XCONST hs_smatrix &A)
 p = amd(A+A') if symmetric is true, or amd(A'A) otherwise More...
 
ivector cs_amd (XCONST dvar_hs_smatrix &A)
 
ivector cs_counts (XCONST hs_smatrix &A, XCONST ivector &parent, XCONST ivector &post)
 
ivector cs_counts (XCONST dvar_hs_smatrix &A, XCONST ivector &parent, XCONST ivector &post)
 
double cs_cumsum (ivector &p, ivector &c, int n)
 
int cs_diag (int i, int j, double aij, void *other)
 
int cs_diag (int i, int j, const prevariable &aij, void *other)
 
int cs_ereach (XCONST hs_smatrix &_A, int k, XCONST ivector &parent, ivector &s, ivector &w)
 
int cs_ereach (XCONST dvar_hs_smatrix &_A, int k, XCONST ivector &parent, ivector &s, ivector &w)
 
ivector cs_etree (XCONST hs_smatrix &_A)
 
ivector cs_etree (XCONST dvar_hs_smatrix &_A)
 
int cs_fkeep (hs_smatrix &A, int(*fkeep)(int, int, double, void *), void *other)
 
int cs_fkeep (dvar_hs_smatrix &A, int(*fkeep)(int, int, const prevariable &, void *), void *other)
 
dvector cs_ipvec (XCONST ivector &p, XCONST dvector &b)
 
int cs_leaf (int i, int j, XCONST ivector &first, ivector &maxfirst, ivector &prevleaf, ivector &ancestor, int *jleaf)
 
dvector cs_lsolve (XCONST hs_smatrix &LL, XCONST dvector &y)
 
dvar_vector cs_lsolve (XCONST dvar_hs_smatrix &LL, XCONST dvar_vector &y)
 
dvar_vector cs_lsolve (XCONST dvar_hs_smatrix &LL, XCONST dvector &y)
 
dvector cs_ltsolve (XCONST hs_smatrix &LL, XCONST dvector &y)
 
dvar_vector cs_ltsolve (XCONST dvar_hs_smatrix &LL, XCONST dvar_vector &y)
 
hs_smatrix cs_multiply (const hs_smatrix &A, const hs_smatrix &B)
 
ivector cs_pinv (XCONST ivector &p, int n)
 
ivector cs_post (XCONST ivector &parent, int n)
 
dvector cs_pvec (XCONST ivector &p, XCONST dvector &b)
 
dvar_vector cs_pvec (XCONST ivector &p, XCONST dvar_vector &b)
 
int cs_scatter (XCONST hs_smatrix &AA, int j, double beta, ivector &w, dvector &x, int mark, hs_smatrix &C, int nz)
 
int cs_scatter (XCONST dvar_hs_smatrix &AA, int j, double beta, ivector &w, dvar_vector &x, int mark, dvar_hs_smatrix &C, int nz)
 
int cs_tdfs (int j, int k, ivector &head, XCONST ivector &next, ivector &post, ivector &stack)
 
void cs_transpose (XCONST hs_smatrix &_A, int values, hs_smatrix &C)
 
void cs_transpose (XCONST dvar_hs_smatrix &_A, int values, dvar_hs_smatrix &C)
 
int cs_wclear (int mark, int lemax, ivector &w, int n)
 
static void dfcholeski_sparse (void)
 
void get_inverse_sparse_hessian (dcompressed_triplet &st, hs_symbolic &S, uostream &ofs1, ofstream &ofs, int usize, int xsize, dvector &u)
 
void hs_symperm (XCONST hs_smatrix &_A, XCONST ivector &pinv, hs_smatrix &C)
 
void hs_symperm (XCONST dvar_hs_smatrix &_A, XCONST ivector &pinv, dvar_hs_smatrix &C)
 
dvariable ln_det (XCONST dvar_hs_smatrix &M)
 
dvariable ln_det (XCONST dvar_hs_smatrix &_M, int &sgn)
 
double ln_det (XCONST hs_smatrix &_M)
 
double ln_det (XCONST hs_smatrix &_M, int &sgn)
 
dvariable ln_det (dvar_compressed_triplet &VM)
 
dvariable ln_det (dvar_compressed_triplet &VM, hs_symbolic &S)
 
dvariable ln_det (dvar_compressed_triplet &VM, hs_symbolic &S, dcompressed_triplet &s)
 
double ln_det (const dcompressed_triplet &VVM, const hs_symbolic &T)
 
double ln_det (const dcompressed_triplet &VVM)
 
dcompressed_triplet make_dcompressed_triplet (const dmatrix &M)
 
dmatrix make_dmatrix (dcompressed_triplet &M, int n, int m)
 
dmatrix make_dmatrix (dcompressed_triplet &M)
 
dmatrix make_dmatrix (const hs_smatrix &M)
 
dvar_matrix make_dvar_matrix (dvar_compressed_triplet &M)
 
dvar_matrix make_dvar_matrix (dvar_compressed_triplet &M, int n, int m)
 
hs_smatrix make_hs_smatrix (const dmatrix &M)
 
dmatrix make_sdmatrix (dcompressed_triplet &M)
 
dvar_matrix make_sdvar_matrix (dvar_compressed_triplet &M)
 
void myacc (int &p, int Lpi1, int ci, const ivector &Li, dvector &x, const dvector &Lx, const double &lki)
 
hs_smatrix operator* (const hs_smatrix &A, const hs_smatrix &B)
 
ostream & operator<< (const ostream &_ofs, const hs_smatrix &M)
 
istream & operator>> (istream &is, dcompressed_triplet &M)
 
istream & operator>> (istream &is, dvar_compressed_triplet &M)
 
void report_derivatives (const dvar_vector &x)
 
void report_dvar_vector_derivatives (void)
 
hs_smatrix * return_choleski_decomp (dcompressed_triplet &st)
 
dvar_hs_smatrix * return_choleski_decomp (dvar_compressed_triplet &st)
 
dvector return_choleski_decomp_solve (dcompressed_triplet &st, dvector &eps)
 
dvector return_choleski_factor_solve (hs_smatrix *PL, dvector &eps)
 
dvar_vector return_choleski_factor_solve (dvar_hs_smatrix *PL, dvector &eps)
 
dvector solve (dcompressed_triplet &st, dmatrix &Hess, dvector &grad)
 
dvector solve (dcompressed_triplet &st, dmatrix &Hess, dvector &grad, hs_symbolic &S)
 
dvector solve (const dcompressed_triplet &_st, const dvector &_grad, const hs_symbolic &S)
 
dvector solve (const dcompressed_triplet &_st, const dvector &_grad, const hs_symbolic &S, int &ierr)
 
int tmpxchol (XCONST hs_smatrix &A, XCONST hs_symbolic &S, hs_smatrix &L, ivector &xcount)
 
int tmpxchol1 (XCONST hs_smatrix &A, XCONST hs_symbolic &T, hs_smatrix &L, ivector &nxcount)
 
int varchol (XCONST dvar_hs_smatrix &A, XCONST hs_symbolic &S, dvar_hs_smatrix &L, dcompressed_triplet &sparse_triplet2)
 
static void xxx (int i)
 
static void xxx (ivector &i)
 
static void xxxv (ivector &x)
 

Variables

int check_flag =0
 

Macro Definition Documentation

#define USE_ADJOINT_CODE

Definition at line 21 of file hs_sparse.cpp.

#define XCONST   const

Definition at line 17 of file hs_sparse.cpp.

Function Documentation

int allocated ( const dcompressed_triplet _st)

Definition at line 2855 of file hs_sparse.cpp.

int allocated ( const dvar_compressed_triplet _st)

Definition at line 2860 of file hs_sparse.cpp.

int chol ( XCONST hs_smatrix &  A,
XCONST hs_symbolic T,
hs_smatrix &  L 
)
int chol ( XCONST dvar_hs_smatrix &  AA,
XCONST hs_symbolic T,
dvar_hs_smatrix &  LL 
)

Definition at line 3432 of file hs_sparse.cpp.

int cholnew ( XCONST hs_smatrix &  A,
XCONST hs_symbolic S,
hs_smatrix &  L 
)

Definition at line 2973 of file hs_sparse.cpp.

hs_smatrix cs_add ( XCONST hs_smatrix &  AA,
XCONST hs_smatrix &  BB,
double  alpha,
double  beta 
)

Definition at line 1404 of file hs_sparse.cpp.

Referenced by cs_amd().

dvar_hs_smatrix cs_add ( XCONST dvar_hs_smatrix &  AA,
XCONST dvar_hs_smatrix &  BB,
double  alpha,
double  beta 
)

Definition at line 1449 of file hs_sparse.cpp.

ivector cs_amd ( XCONST hs_smatrix &  A)

p = amd(A+A') if symmetric is true, or amd(A'A) otherwise

Todo:
Need test case.

Definition at line 1522 of file hs_sparse.cpp.

ivector cs_amd ( XCONST dvar_hs_smatrix &  A)
Todo:
Need test case.

Definition at line 1859 of file hs_sparse.cpp.

ivector cs_counts ( XCONST hs_smatrix &  A,
XCONST ivector parent,
XCONST ivector post 
)

Definition at line 2308 of file hs_sparse.cpp.

ivector cs_counts ( XCONST dvar_hs_smatrix &  A,
XCONST ivector parent,
XCONST ivector post 
)

Definition at line 2364 of file hs_sparse.cpp.

double cs_cumsum ( ivector p,
ivector c,
int  n 
)

Definition at line 59 of file hs_sparse.cpp.

Referenced by cs_transpose(), and hs_symperm().

int cs_diag ( int  i,
int  j,
double  aij,
void *  other 
)

Definition at line 1273 of file hs_sparse.cpp.

Referenced by cs_amd().

int cs_diag ( int  i,
int  j,
const prevariable aij,
void *  other 
)

Definition at line 1274 of file hs_sparse.cpp.

int cs_ereach ( XCONST hs_smatrix &  _A,
int  k,
XCONST ivector parent,
ivector s,
ivector w 
)

Definition at line 744 of file hs_sparse.cpp.

Referenced by chol(), cholnew(), dfcholeski_sparse(), tmpxchol1(), and varchol().

int cs_ereach ( XCONST dvar_hs_smatrix &  _A,
int  k,
XCONST ivector parent,
ivector s,
ivector w 
)

Definition at line 773 of file hs_sparse.cpp.

ivector cs_etree ( XCONST hs_smatrix &  _A)

Definition at line 2193 of file hs_sparse.cpp.

ivector cs_etree ( XCONST dvar_hs_smatrix &  _A)

Definition at line 2225 of file hs_sparse.cpp.

int cs_fkeep ( hs_smatrix &  A,
int(*)(int, int, double, void *)  fkeep,
void *  other 
)

Definition at line 1278 of file hs_sparse.cpp.

Referenced by cs_amd().

int cs_fkeep ( dvar_hs_smatrix &  A,
int(*)(int, int, const prevariable &, void *)  fkeep,
void *  other 
)

Definition at line 1305 of file hs_sparse.cpp.

dvector cs_ipvec ( XCONST ivector p,
XCONST dvector b 
)
int cs_leaf ( int  i,
int  j,
XCONST ivector first,
ivector maxfirst,
ivector prevleaf,
ivector ancestor,
int *  jleaf 
)

Definition at line 2287 of file hs_sparse.cpp.

Referenced by cs_counts().

dvector cs_lsolve ( XCONST hs_smatrix &  LL,
XCONST dvector y 
)
dvar_vector cs_lsolve ( XCONST dvar_hs_smatrix &  LL,
XCONST dvar_vector y 
)

Definition at line 1173 of file hs_sparse.cpp.

dvar_vector cs_lsolve ( XCONST dvar_hs_smatrix &  LL,
XCONST dvector y 
)

Definition at line 1198 of file hs_sparse.cpp.

dvector cs_ltsolve ( XCONST hs_smatrix &  LL,
XCONST dvector y 
)

Definition at line 1224 of file hs_sparse.cpp.

Referenced by get_inverse_sparse_hessian(), and solve().

dvar_vector cs_ltsolve ( XCONST dvar_hs_smatrix &  LL,
XCONST dvar_vector y 
)

Definition at line 1248 of file hs_sparse.cpp.

hs_smatrix cs_multiply ( const hs_smatrix &  A,
const hs_smatrix &  B 
)

Definition at line 3604 of file hs_sparse.cpp.

Referenced by operator*().

ivector cs_pinv ( XCONST ivector p,
int  n 
)

Definition at line 2421 of file hs_sparse.cpp.

ivector cs_post ( XCONST ivector parent,
int  n 
)

Definition at line 2258 of file hs_sparse.cpp.

dvector cs_pvec ( XCONST ivector p,
XCONST dvector b 
)
dvar_vector cs_pvec ( XCONST ivector p,
XCONST dvar_vector b 
)

Definition at line 1133 of file hs_sparse.cpp.

int cs_scatter ( XCONST hs_smatrix &  AA,
int  j,
double  beta,
ivector w,
dvector x,
int  mark,
hs_smatrix &  C,
int  nz 
)

Definition at line 1333 of file hs_sparse.cpp.

Referenced by cs_add(), and cs_multiply().

int cs_scatter ( XCONST dvar_hs_smatrix &  AA,
int  j,
double  beta,
ivector w,
dvar_vector x,
int  mark,
dvar_hs_smatrix &  C,
int  nz 
)

Definition at line 1379 of file hs_sparse.cpp.

int cs_tdfs ( int  j,
int  k,
ivector head,
XCONST ivector next,
ivector post,
ivector stack 
)

Definition at line 1495 of file hs_sparse.cpp.

Referenced by cs_amd(), and cs_post().

void cs_transpose ( XCONST hs_smatrix &  _A,
int  values,
hs_smatrix &  C 
)

Definition at line 87 of file hs_sparse.cpp.

Referenced by cs_amd(), and cs_counts().

void cs_transpose ( XCONST dvar_hs_smatrix &  _A,
int  values,
dvar_hs_smatrix &  C 
)

Definition at line 119 of file hs_sparse.cpp.

int cs_wclear ( int  mark,
int  lemax,
ivector w,
int  n 
)

Definition at line 75 of file hs_sparse.cpp.

Referenced by cs_amd().

static void dfcholeski_sparse ( void  )
static

Definition at line 3172 of file hs_sparse.cpp.

Referenced by varchol().

void get_inverse_sparse_hessian ( dcompressed_triplet st,
hs_symbolic S,
uostream ofs1,
ofstream &  ofs,
int  usize,
int  xsize,
dvector u 
)
void hs_symperm ( XCONST hs_smatrix &  _A,
XCONST ivector pinv,
hs_smatrix &  C 
)

Definition at line 803 of file hs_sparse.cpp.

Referenced by chol(), cholnew(), dfcholeski_sparse(), tmpxchol1(), and varchol().

void hs_symperm ( XCONST dvar_hs_smatrix &  _A,
XCONST ivector pinv,
dvar_hs_smatrix &  C 
)

Definition at line 845 of file hs_sparse.cpp.

dvariable ln_det ( XCONST dvar_hs_smatrix &  M)

Definition at line 666 of file hs_sparse.cpp.

dvariable ln_det ( XCONST dvar_hs_smatrix &  _M,
int &  sgn 
)

Definition at line 673 of file hs_sparse.cpp.

double ln_det ( XCONST hs_smatrix &  _M)

Definition at line 679 of file hs_sparse.cpp.

double ln_det ( XCONST hs_smatrix &  _M,
int &  sgn 
)

Definition at line 685 of file hs_sparse.cpp.

Definition at line 2865 of file hs_sparse.cpp.

dvariable ln_det ( dvar_compressed_triplet VM,
hs_symbolic S 
)

Definition at line 2882 of file hs_sparse.cpp.

Definition at line 2901 of file hs_sparse.cpp.

double ln_det ( const dcompressed_triplet VVM,
const hs_symbolic T 
)

Definition at line 2932 of file hs_sparse.cpp.

double ln_det ( const dcompressed_triplet VVM)

Definition at line 2954 of file hs_sparse.cpp.

dcompressed_triplet make_dcompressed_triplet ( const dmatrix M)

Definition at line 3656 of file hs_sparse.cpp.

Referenced by make_hs_smatrix().

dmatrix make_dmatrix ( dcompressed_triplet M,
int  n,
int  m 
)

Definition at line 153 of file hs_sparse.cpp.

dmatrix make_dmatrix ( dcompressed_triplet M)
dmatrix make_dmatrix ( const hs_smatrix &  M)

Definition at line 3719 of file hs_sparse.cpp.

dvar_matrix make_dvar_matrix ( dvar_compressed_triplet M)

Definition at line 187 of file hs_sparse.cpp.

dvar_matrix make_dvar_matrix ( dvar_compressed_triplet M,
int  n,
int  m 
)

Definition at line 234 of file hs_sparse.cpp.

hs_smatrix make_hs_smatrix ( const dmatrix M)

Definition at line 3703 of file hs_sparse.cpp.

dmatrix make_sdmatrix ( dcompressed_triplet M)

Definition at line 216 of file hs_sparse.cpp.

dvar_matrix make_sdvar_matrix ( dvar_compressed_triplet M)

Definition at line 169 of file hs_sparse.cpp.

void myacc ( int &  p,
int  Lpi1,
int  ci,
const ivector Li,
dvector x,
const dvector Lx,
const double &  lki 
)

Definition at line 889 of file hs_sparse.cpp.

Referenced by cholnew().

hs_smatrix operator* ( const hs_smatrix &  A,
const hs_smatrix &  B 
)

Definition at line 3652 of file hs_sparse.cpp.

ostream& operator<< ( const ostream &  _ofs,
const hs_smatrix &  M 
)

Definition at line 3708 of file hs_sparse.cpp.

istream& operator>> ( istream &  is,
dcompressed_triplet M 
)

Definition at line 2610 of file hs_sparse.cpp.

istream& operator>> ( istream &  is,
dvar_compressed_triplet M 
)

Definition at line 2623 of file hs_sparse.cpp.

void report_derivatives ( const dvar_vector x)

Definition at line 3563 of file hs_sparse.cpp.

void report_dvar_vector_derivatives ( void  )

Definition at line 3552 of file hs_sparse.cpp.

Referenced by report_derivatives().

hs_smatrix* return_choleski_decomp ( dcompressed_triplet st)

Definition at line 2636 of file hs_sparse.cpp.

Referenced by calculate_importance_sample_shess().

dvar_hs_smatrix* return_choleski_decomp ( dvar_compressed_triplet st)

Definition at line 2653 of file hs_sparse.cpp.

dvector return_choleski_decomp_solve ( dcompressed_triplet st,
dvector eps 
)

Definition at line 2670 of file hs_sparse.cpp.

dvector return_choleski_factor_solve ( hs_smatrix *  PL,
dvector eps 
)

Definition at line 2693 of file hs_sparse.cpp.

Referenced by calculate_importance_sample_shess().

dvar_vector return_choleski_factor_solve ( dvar_hs_smatrix *  PL,
dvector eps 
)

Definition at line 2710 of file hs_sparse.cpp.

dvector solve ( dcompressed_triplet st,
dmatrix Hess,
dvector grad 
)

Definition at line 2728 of file hs_sparse.cpp.

dvector solve ( dcompressed_triplet st,
dmatrix Hess,
dvector grad,
hs_symbolic S 
)

Definition at line 2758 of file hs_sparse.cpp.

dvector solve ( const dcompressed_triplet _st,
const dvector _grad,
const hs_symbolic S 
)

Definition at line 2793 of file hs_sparse.cpp.

dvector solve ( const dcompressed_triplet _st,
const dvector _grad,
const hs_symbolic S,
int &  ierr 
)

Definition at line 2820 of file hs_sparse.cpp.

int tmpxchol ( XCONST hs_smatrix &  A,
XCONST hs_symbolic S,
hs_smatrix &  L,
ivector xcount 
)
int tmpxchol1 ( XCONST hs_smatrix &  A,
XCONST hs_symbolic T,
hs_smatrix &  L,
ivector nxcount 
)

Definition at line 976 of file hs_sparse.cpp.

int varchol ( XCONST dvar_hs_smatrix &  A,
XCONST hs_symbolic S,
dvar_hs_smatrix &  L,
dcompressed_triplet sparse_triplet2 
)

Definition at line 3061 of file hs_sparse.cpp.

Referenced by ln_det().

static void xxx ( int  i)
static

Definition at line 24 of file hs_sparse.cpp.

static void xxx ( ivector i)
static

Definition at line 25 of file hs_sparse.cpp.

static void xxxv ( ivector x)
static

Definition at line 26 of file hs_sparse.cpp.

Referenced by tmpxchol1().

Variable Documentation

int check_flag =0

Definition at line 2899 of file hs_sparse.cpp.