00001 /* 00002 * $Id$ 00003 * 00004 * Author: David Fournier 00005 * Copyright (c) 2008-2012 Regents of the University of California 00006 */ 00011 //#define USE_DD_STUFF 00012 //#define USE_DD 00013 # include <admodel.h> 00014 //# include <hs.h> 00015 /* 00016 dvector solve(const dmatrix & _st,const dmatrix & Hess, 00017 const dvector& grad) 00018 { 00019 ADUNCONST(dmatrix,st) 00020 int nz=st.indexmax(); 00021 int n=Hess.indexmax(); 00022 // fill up compressed triplet with nonzero entries of the Hessian 00023 for (int i=1;i<=nz;i++) 00024 { 00025 st(i,3)=Hess(st(i,1),st(i,2)); 00026 } 00027 00028 hs_smatrix HS(n,st); // Convert triplet to working format 00029 00030 hs_symbolic S(n,st,1); // Fill reducing row-col permutation 00031 hs_smatrix L(S); // Allocates cholesky factor 00032 00033 chol(HS,S,L); // Does numeric factorization 00034 00035 dvector x(0,n-1); 00036 grad.shift(0); 00037 x = cs_ipvec(S.pinv, grad); 00038 grad.shift(1); 00039 x = cs_lsolve(L,x); 00040 x = cs_ltsolve(L,x); 00041 x = cs_pvec(S.pinv,x); 00042 x.shift(1); 00043 return x; 00044 } 00045 */
Generated on Tue Mar 8 2016 19:51:31 for ADMB Documentation by 1.8.0 |