41 int piv_length = piv.
dim();
46 for (
int i = 0; i < piv_length; i++)
47 for (
int j = j0; j <= j1; j++)
48 X[i][j-j0] = A[piv[i]][j];
56 int piv_length = piv.
dim();
57 if (piv_length != A.
dim())
63 for (
int i = 0; i < piv_length; i++)
85 for (
int i = 0; i < m; i++) {
94 for (
int j = 0; j < n; j++) {
98 for (
int i = 0; i < m; i++) {
99 LUcolj[i] = LU_[i][j];
104 for (
int i = 0; i < m; i++) {
111 for (
int k = 0; k < kmax; k++) {
112 s += LUrowi[k]*LUcolj[k];
115 LUrowi[j] = LUcolj[i] -= s;
121 for (
int i = j+1; i < m; i++) {
122 if (abs(LUcolj[i]) > abs(LUcolj[p])) {
128 for (k = 0; k < n; k++) {
129 double t = LU_[p][k];
130 LU_[p][k] = LU_[j][k];
141 if ((j < m) && (LU_[j][j] != 0.0)) {
142 for (
int i = j+1; i < m; i++) {
143 LU_[i][j] /= LU_[j][j];
156 for (
int j = 0; j < n; j++) {
169 for (
int i = 0; i < m; i++) {
170 for (
int j = 0; j < n; j++) {
172 L_[i][j] = LU_[i][j];
189 for (
int i = 0; i < n; i++) {
190 for (
int j = 0; j < n; j++) {
192 U_[i][j] = LU_[i][j];
219 for (
int j = 0; j < n; j++) {
239 if (!isNonsingular()) {
250 for (
int k = 0; k < n; k++) {
251 for (
int i = k+1; i < n; i++) {
252 for (
int j = 0; j < nx; j++) {
253 X[i][j] -= X[k][j]*LU_[i][k];
258 for (
int k = n-1; k >= 0; k--) {
259 for (
int j = 0; j < nx; j++) {
260 X[k][j] /= LU_[k][k];
262 for (
int i = 0; i < k; i++) {
263 for (
int j = 0; j < nx; j++) {
264 X[i][j] -= X[k][j]*LU_[i][k];
289 if (!isNonsingular()) {
297 for (
int k = 0; k < n; k++) {
298 for (
int i = k+1; i < n; i++) {
299 x[i] -= x[k]*LU_[i][k];
304 for (
int k = n-1; k >= 0; k--) {
306 for (
int i = 0; i < k; i++)
307 x[i] -= x[k]*LU_[i][k];
Array1D< int > piv
Definition: jama_lu.h:35
int isNonsingular()
Definition: jama_lu.h:155
LU(const Array2D< Real > &A)
Definition: jama_lu.h:77
Array1D< Real > permute_copy(const Array1D< Real > &A, const Array1D< int > &piv)
Definition: jama_lu.h:53
Array2D< Real > getL()
Definition: jama_lu.h:167
Array1D< Real > solve(const Array1D< Real > &b)
Definition: jama_lu.h:281
int m
Definition: jama_lu.h:34
Array2D< Real > LU_
Definition: jama_lu.h:33
Array2D< Real > getU()
Definition: jama_lu.h:187
Array1D< int > getPivot()
Definition: jama_lu.h:205
Array2D< Real > solve(const Array2D< Real > &B)
Definition: jama_lu.h:231
Real det()
Definition: jama_lu.h:214
Array2D< Real > permute_copy(const Array2D< Real > &A, const Array1D< int > &piv, int j0, int j1)
Definition: jama_lu.h:38
int dim1() const
Definition: tnt_array1d.h:218
int dim() const
Definition: tnt_array1d.h:221
int dim1() const
Definition: tnt_array2d.h:231
int dim2() const
Definition: tnt_array2d.h:234
Definition: jama_cholesky.h:9
Definition: tnt_array1d.h:36
float Real
Definition: types.h:69