23 return solve(aa,tz,ln,sgn);
44 cerr <<
"Error matrix not square in solve()"<<
endl;
57 for (
int i = lb;i<=ub;i++)
60 for (
int j = lb;j<=ub;j++)
68 if (
value(big) == 0.0)
71 "Error in matrix inverse -- matrix singular in inv(df1b2matrix)\n";
76 for (
int j = lb;j<=ub;j++)
78 for (
int i = lb;i<j;i++)
81 for (
int k = lb;k<i;k++)
83 sum -= bb(i,k)*bb(k,j);
90 for (
int i = j;i<=ub;i++)
93 for (
int k = lb;k<j;k++)
95 sum -= bb(i,k)*bb(k,j);
98 dum = vv[i]*
fabs(sum);
107 for (
int k = lb;k<=ub;k++)
110 bb(imax,k) = bb(j,k);
118 int itemp = indx(imax);
119 indx(imax) = indx(j);
133 for (
int i = j+1;i<=ub;i++)
135 bb(i,j) = bb(i,j) * dum;
143 part_prod(lb) =
log(
fabs(bb(lb,lb)));
145 for (
int j = lb+1;j<=ub;j++)
148 part_prod(j) = part_prod(j-1)+
log(
fabs(bb(j,j)));
150 ln_unsigned_det = part_prod(ub);
163 for (
int i = lb;i<=ub;i++)
165 indxinv(indx(i)) = i;
167 for (
int kk = mmin;kk<=mmax;kk++)
169 for (
int i = lb;i<=ub;i++)
171 y(indxinv(i)) = z(kk)(i);
174 for (
int i = lb;i<=ub;i++)
177 for (
int j = lb;j<=i-1;j++)
183 for (
int i = ub;i>=lb;i--)
186 for (
int j = i+1;j<=ub;j++)
188 sum-=b(i,j)*
x(kk)(j);
190 x(kk)(i) = sum/b(i,i);
224 {cout<<
"Error: Not square matrix in expm."<<
endl;
ad_exit(1);}
226 {cout<<
"Error: Not square matrix in expm."<<
endl;
ad_exit(1);}
236 for(
int i = rmin; i<=rmax; ++i){I(i,i) = 1.0;}
240 log2NormInf/=
log(2.0);
241 int e = (int)
value(log2NormInf) + 1;
244 AA = 1.0/
pow(2.0,s)*A;
252 for(
int k = 2; k<=q; ++k){
253 c*=((double)q-k+1.0)/((double)k*(2*q-k+1));
257 if(p==1){D+=cX;}
else{D-=cX;}
262 for(
int k = 1; k<=s; ++k){
dmatrix trans(const dmatrix &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dmatrix expm(const dmatrix &A)
Matrix exponential.
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Description not yet available.
df1_two_variable fabs(const df1_two_variable &x)
void initialize(void)
Description not yet available.
void fill_seqadd(int, int)
Fills ivector elements with values starting from base and incremented by offset.
Description not yet available.
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.
dvector rowsum(const dmatrix &matrix)
Returns dvector where each element contains the sum total of each row in matrix.
void RETURN_ARRAYS_INCREMENT()
static _THREAD gradient_structure * _instance
Description not yet available.
Description not yet available.
double sign(const double x)
The sign of a number.
void RETURN_ARRAYS_DECREMENT()
dvector value(const df1_one_vector &v)
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array pow(const d3_array &m, int e)
Description not yet available.