ADMB Documentation  11.1.2382
 All Classes Files Functions Variables Typedefs Friends Defines
df1b2lp12.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: df1b2lp12.cpp 1919 2014-04-22 22:02:01Z johnoel $
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 */