21 #define ISZERO(d) ((d)==0.0)
46 cerr <<
"Error -- non square matrix passed to "
47 "dvector eigen(const dmatrix& m)\n";
52 #if !defined(OPT_LIB) && (__cplusplus >= 201103L)
53 int n = [](
unsigned int rowsize) ->
int
56 return static_cast<int>(
rowsize);
59 int n =
static_cast<int>(m1.
rowsize());
105 cerr <<
"Error -- non square matrix passed to "
106 "void tridag(const dvar_matrix& m)\n";
110 || d.indexmin() != 1 || e.indexmin() !=1 )
112 cerr <<
"Error -- incorrect vector size passed to "
113 "void tridag(const dmatrix& m)\n";
116 #if !defined(OPT_LIB) && (__cplusplus >= 201103L)
117 int n = [](
unsigned int rowsize) ->
int
120 return static_cast<int>(
rowsize);
123 int n =
static_cast<int>(m.
rowsize());
135 scale +=
fabs(m[i][k]);
143 h += m[i][k]*m[i][k];
159 g += m[j][k]*m[i][k];
161 g += m[k][j]*m[i][k];
171 m[j][k] -= (f*e[k]+g*m[i][k]);
196 g += m[i][k]*m[k][j];
198 m[k][j] -= g*m[k][i];
203 for (j=1;j<=l;j++) m[j][i]=m[i][j]=0.0;
246 #if !defined(OPT_LIB) && (__cplusplus >= 201103L)
247 int n = [](
unsigned int size) ->
int
249 assert(size <= INT_MAX);
250 return static_cast<int>(size);
253 int n =
static_cast<int>(d.
size());
258 for (i=2;i<=n;i++) e[i-1]=e[i];
263 for (m=l;m<=n-1;m++) {
265 if (
fabs(e[m])+dd == dd)
break;
271 cerr <<
"Maximum number of iterations exceeded in"
272 " dvector eigen(const dmatrix& m)\n";
275 g=(d[l+1]-d[l])/(2.0*e[l]);
277 g=d[m]-d[l]+e[l]/(g+
SIGNV(r,g));
280 for (i=m-1;i>=l;i--) {
295 r=(d[i]-g)*s+2.0*c*b;
304 z[k][i+1]=s*z[k][i]+c*f;
305 z[k][i]=c*z[k][i]-s*f;
Base class for dvariable.
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
df1_two_variable fabs(const df1_two_variable &x)
unsigned int size() const
void get_eigen(const dvar_vector &d, const dvar_vector &e, const dvar_matrix &z)
Eigenvalues.
void get_eigenv(const dvar_vector &d, const dvar_vector &e, const dvar_matrix &z)
Eigenvalues and eigenvectors.
dmatrix symmetrize(const dmatrix &matrix)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dmatrix eigenvectors(const banded_symmetric_dmatrix &_SS, const dvector &_e)
Description not yet available.
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.
void rowshift(int min)
Description not yet available.
unsigned int rowsize() const
void tri_dag(const dvar_matrix &, const dvar_vector &, const dvar_vector &)
Householder transformation for eigenvalue computation.
Class definition of matrix with derivitive information .
void tri_dagv(const dvar_matrix &, const dvar_vector &, const dvar_vector &)
Householder transformation for eivenvector computation.
dvariable SIGNV(const prevariable &x, const prevariable &y)
Change sign.
dvector value(const df1_one_vector &v)
void colshift(int min)
Description not yet available.
Fundamental data type for reverse mode automatic differentiation.
unsigned int colsize() const