ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
df1b2lp12.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 //#define USE_DD_STUFF
12 //#define USE_DD
13 # include <admodel.h>
14 //# include <hs.h>
15 /*
16 dvector solve(const dmatrix & _st,const dmatrix & Hess,
17  const dvector& grad)
18 {
19  ADUNCONST(dmatrix,st)
20  int nz=st.indexmax();
21  int n=Hess.indexmax();
22  // fill up compressed triplet with nonzero entries of the Hessian
23  for (int i=1;i<=nz;i++)
24  {
25  st(i,3)=Hess(st(i,1),st(i,2));
26  }
27 
28  hs_smatrix HS(n,st); // Convert triplet to working format
29 
30  hs_symbolic S(n,st,1); // Fill reducing row-col permutation
31  hs_smatrix L(S); // Allocates cholesky factor
32 
33  chol(HS,S,L); // Does numeric factorization
34 
35  dvector x(0,n-1);
36  grad.shift(0);
37  x = cs_ipvec(S.pinv, grad);
38  grad.shift(1);
39  x = cs_lsolve(L,x);
40  x = cs_ltsolve(L,x);
41  x = cs_pvec(S.pinv,x);
42  x.shift(1);
43  return x;
44 }
45 */
Description not yet available.