17 #define ISZERO(d) ((d)==0.0)
45 cerr <<
" Error in dmatrix inv(const dmatrix&) -- matrix not square \n";
53 for (
int i = min; i <=
max; ++i)
57 for (
int j = min; j <=
max; ++j)
77 for (
int j = min; j <=
max; ++j)
80 for (
int i= min; i <=
max; ++i)
92 for (
int i= min; i <=
max; ++i)
94 *(pyi->
get_v() + j)= *pcoli;
122 cerr <<
" Error in dmatrix inv(const dmatrix&) -- matrix not square \n";
129 const dvector* pm1i = &m1(min);
130 for (
int i = min; i <=
max; ++i)
132 double* pm1ij = pm1i->
get_v() +
min;
134 for (
int j = min; j <=
max; ++j)
150 int&
sgn=(
int&)(_sgn);
163 double&
ln_det=(
double&)(_ln_det);
165 for (
int j = min; j <=
max; ++j)
167 double ajj = a(j, j);
187 for (
int j = min; j <=
max; ++j)
190 for (
int i= min; i <=
max; ++i)
202 for (
int i = min; i <=
max; ++i)
204 *(pyi->
get_v() + j)= *pcoli;
226 double& d=(
double&)_d;
230 #if !defined(OPT_LIB) && (__cplusplus >= 201103L)
231 int n = [](
unsigned int colsize) ->
int
233 assert(colsize <= INT_MAX);
234 return static_cast<int>(colsize);
237 int n =
static_cast<int>(a.
colsize());
247 double* pvvi = vv.
get_v() + lb;
252 double* paij = pai->
get_v() + lb;
255 double temp=
fabs(*paij);
266 output_stream <<
"Error: division by zero in ludcmp\n";
283 sum = sum - a[i][k]*a[k][j];
294 sum = sum - a[i][k]*a[k][j];
297 double dum=vv[i]*
fabs(sum);
308 double dum=a[imax][k];
324 double dum=1.0/(a[j][j]);
325 for (i=j+1;i<=ub;i++)
327 a[i][j] = a[i][j] * dum;
334 #define TINY 1.0e-50;
347 double& d=(
double&)_d;
351 #if !defined(OPT_LIB) && (__cplusplus >= 201103L)
352 int n = [](
unsigned int colsize) ->
int
354 assert(colsize <= INT_MAX);
355 return static_cast<int>(colsize);
358 int n =
static_cast<int>(a.
colsize());
372 double temp=
fabs(a[i][j]);
394 sum = sum - a[i][k]*a[k][j];
405 sum = sum - a[i][k]*a[k][j];
408 double dum=vv[i]*
fabs(sum);
419 double dum=a[imax][k];
435 double dum=1.0/(a[j][j]);
436 for (i=j+1;i<=ub;i++)
438 a[i][j] = a[i][j] * dum;
457 int i,ii=0,ip,j,iiflag=0;
467 for (j=ii;j<=i-1;j++)
483 for (j=i+1;j<=ub;j++)
506 cerr <<
"Matrix not square in routine det()" <<
endl;
544 cerr <<
"Matrix not square in routine det()" <<
endl;
552 const dvector* pm1i = &m1(min);
553 for (
int i = min; i <=
max; ++i)
555 double* pm1ij = pm1i->
get_v() +
min;
557 for (
int j = min; j <=
max; ++j)
586 for (
int j = min; j <=
max; ++j)
588 double ajj = a(j, j);
618 double& d=(
double&)_d;
621 #if !defined(OPT_LIB) && (__cplusplus >= 201103L)
622 int n = [](
unsigned int colsize) ->
int
624 assert(colsize <= INT_MAX);
625 return static_cast<int>(colsize);
628 int n =
static_cast<int>(a.
colsize());
643 double temp=
fabs(a[i][j]);
651 cerr <<
"Error in matrix inverse -- matrix singular in inv(dmatrix)\n";
665 sum = sum - a[i][k]*a[k][j];
676 sum = sum - a[i][k]*a[k][j];
679 double dum=vv[i]*
fabs(sum);
690 double dum=a[imax][k];
696 int itemp=indx.
elem(imax);
708 double dum=1.0/(a[j][j]);
709 for (i=j+1;i<=ub;i++)
711 a[i][j] = a[i][j] * dum;
void ludcmp_index(const dmatrix &_a, const ivector &_indx, const double &_d)
LU decomposition.
void ludcmp(const dmatrix &a, const ivector &indx, const double &d)
Lu decomposition of a constant matrix.
Vector of double precision numbers.
void lubksb(dmatrix a, const ivector &indx, dvector b)
LU decomposition back susbstitution alogrithm for constant object.
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.
#define TINY
A small number.
unsigned int colsize() const
ivector sgn(const dvector &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
double det(const dmatrix &m1)
Compute determinant of a constant matrix.
prnstream & endl(prnstream &)
Array of integers(int) with indexes from index_min to indexmax.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Description not yet available.
double ln_det(const dmatrix &m1, int &sgn)
Compute log determinant of a constant matrix.
std::ostream & get_output_stream()
void ludcmp_det(const dmatrix &_a, const ivector &_indx, const double &_d)
LU decomposition.
df1_one_variable inv(const df1_one_variable &x)
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.