Mercurial > hg > octave-nkf
diff liboctave/CmplxLU.cc @ 1992:5668c00f9c7a
[project @ 1996-03-03 00:40:53 by jwe]
author | jwe |
---|---|
date | Sun, 03 Mar 1996 00:43:53 +0000 |
parents | 3ce2c289c978 |
children | 1b57120c997b |
line wrap: on
line diff
--- a/liboctave/CmplxLU.cc +++ b/liboctave/CmplxLU.cc @@ -34,6 +34,15 @@ #include "lo-error.h" #include "mx-inlines.cc" +// Instantiate the base LU class for the types we need. + +#include <base-lu.h> +#include <base-lu.cc> + +template class base_lu <ComplexMatrix, Matrix>; + +// Define the constructor for this particular derivation. + extern "C" { int F77_FCN (zgesv, ZGESV) (const int&, const int&, Complex*, @@ -54,12 +63,11 @@ int n = a_nr; - Array<int> ipvt (n); - + ipvt.resize (n); int *pipvt = ipvt.fortran_vec (); - ComplexMatrix A_fact = a; - Complex *tmp_data = A_fact.fortran_vec (); + a_fact = a; + Complex *tmp_data = a_fact.fortran_vec (); int info = 0; Complex *dummy = 0; @@ -69,43 +77,7 @@ if (f77_exception_encountered) (*current_liboctave_error_handler) ("unrecoverable error in zgesv"); else - { - Array<int> pvt (n); - - for (int i = 0; i < n; i++) - { - ipvt.elem (i) -= 1; - pvt.elem (i) = i; - } - - for (int i = 0; i < n - 1; i++) - { - int k = ipvt.elem (i); - - if (k != i) - { - int tmp = pvt.elem (k); - pvt.elem (k) = pvt.elem (i); - pvt.elem (i)= tmp; - } - } - - l.resize (n, n, 0.0); - u.resize (n, n, 0.0); - p.resize (n, n, 0.0); - - for (int i = 0; i < n; i++) - { - p.elem (i, pvt.elem (i)) = 1.0; - - l.elem (i, i) = 1.0; - for (int j = 0; j < i; j++) - l.elem (i, j) = A_fact.elem (i, j); - - for (int j = i; j < n; j++) - u.elem (i, j) = A_fact.elem (i, j); - } - } + ipvt -= 1; } /*