18 #if defined (__WAT32__)
24 #include <iostream.hpp>
30 const double& ln_unsigned_det,
double&
sign);
40 return solve(aa,tz,ln,sgn);
50 const double& _ln_unsigned_det,
double&
sign)
52 double& ln_unsigned_det = (
double&)_ln_unsigned_det;
53 #if !defined(OPT_LIB) && (__cplusplus >= 201103L)
54 int n = [](
unsigned int colsize) ->
int
56 assert(colsize <= INT_MAX);
57 return static_cast<int>(colsize);
60 int n =
static_cast<int>(aa.
colsize());
66 cerr <<
"Error matrix not square in solve()"<<
endl;
77 for (
int i=lb;i<=ub;i++)
80 for (
int j=lb;j<=ub;j++)
82 double temp=
fabs(bb(i,j));
90 cerr <<
"Error in matrix inverse -- matrix singular in inv(dmatrix)\n";
95 for (
int j=lb;j<=ub;j++)
97 for (
int i=lb;i<j;i++)
100 for (
int k=lb;k<i;k++)
102 sum -= bb(i,k)*bb(k,j);
109 for (
int i=j;i<=ub;i++)
112 for (
int k=lb;k<j;k++)
114 sum -= bb(i,k)*bb(k,j);
117 double dum=vv[i]*
fabs(sum);
126 for (
int k=lb;k<=ub;k++)
128 double dum=bb(imax,k);
137 int itemp=indx(imax);
151 double dum=1.0/bb(j,j);
152 for (
int i=j+1;i<=ub;i++)
154 bb(i,j) = bb(i,j) * dum;
162 part_prod(lb)=
log(
fabs(bb(lb,lb)));
163 if (bb(lb,lb)<0) sign=-
sign;
164 for (
int j=lb+1;j<=ub;j++)
166 if (bb(j,j)<0) sign=-
sign;
167 part_prod(j)=part_prod(j-1)+
log(
fabs(bb(j,j)));
169 ln_unsigned_det=part_prod(ub);
182 for (
int i=lb;i<=ub;i++)
186 for (
int kk=mmin;kk<=mmax;kk++)
188 for (
int i=lb;i<=ub;i++)
190 y(indxinv(i))=z(kk)(i);
193 for (
int i=lb;i<=ub;i++)
196 for (
int j=lb;j<=i-1;j++)
202 for (
int i=ub;i>=lb;i--)
205 for (
int j=i+1;j<=ub;j++)
207 sum-=b(i,j)*
x(kk)(j);
227 for (
int i=mmin;i<=mmax;i++)
242 for (
int i=1;i<=B.
bw-1;i++)
Description not yet available.
dmatrix trans(const dmatrix &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Vector of double precision numbers.
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
df1_two_variable fabs(const df1_two_variable &x)
void fill_seqadd(int, int)
Fills ivector elements with values starting from base and incremented by offset.
double norm(const d3_array &a)
Return computed norm value of a.
unsigned int colsize() const
df1_one_matrix choleski_decomp(const df1_one_matrix &MM)
ivector sgn(const dvector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvector solve(const dmatrix &aa, const dvector &z)
Solve a linear system using LU decomposition.
prnstream & endl(prnstream &)
Array of integers(int) with indexes from index_min to indexmax.
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Description not yet available.
Description not yet available.
double norm2(const d3_array &a)
Return sum of squared elements in a.
double ln_det_choleski(const banded_symmetric_dmatrix &MM, int &ierr)
double sign(const double x)
The sign of a number.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.