457
|
1 /* |
|
2 |
1882
|
3 Copyright (C) 1996 John W. Eaton |
457
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
457
|
20 |
|
21 */ |
|
22 |
1296
|
23 #if defined (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
457
|
27 #ifdef HAVE_CONFIG_H |
1192
|
28 #include <config.h> |
457
|
29 #endif |
|
30 |
|
31 #include "CmplxLU.h" |
1847
|
32 #include "f77-fcn.h" |
457
|
33 #include "lo-error.h" |
1368
|
34 #include "mx-inlines.cc" |
457
|
35 |
1992
|
36 // Instantiate the base LU class for the types we need. |
|
37 |
|
38 #include <base-lu.h> |
|
39 #include <base-lu.cc> |
|
40 |
2049
|
41 template class base_lu <ComplexMatrix, Complex, Matrix, double>; |
1992
|
42 |
|
43 // Define the constructor for this particular derivation. |
|
44 |
457
|
45 extern "C" |
|
46 { |
1253
|
47 int F77_FCN (zgesv, ZGESV) (const int&, const int&, Complex*, |
|
48 const int&, int*, Complex*, const int&, |
|
49 int&); |
457
|
50 } |
|
51 |
|
52 ComplexLU::ComplexLU (const ComplexMatrix& a) |
|
53 { |
|
54 int a_nr = a.rows (); |
|
55 int a_nc = a.cols (); |
1919
|
56 |
457
|
57 if (a_nr == 0 || a_nc == 0 || a_nr != a_nc) |
|
58 { |
|
59 (*current_liboctave_error_handler) ("ComplexLU requires square matrix"); |
|
60 return; |
|
61 } |
|
62 |
|
63 int n = a_nr; |
|
64 |
1992
|
65 ipvt.resize (n); |
1926
|
66 int *pipvt = ipvt.fortran_vec (); |
1919
|
67 |
1992
|
68 a_fact = a; |
|
69 Complex *tmp_data = a_fact.fortran_vec (); |
1919
|
70 |
457
|
71 int info = 0; |
1365
|
72 Complex *dummy = 0; |
457
|
73 |
1926
|
74 F77_XFCN (zgesv, ZGESV, (n, 0, tmp_data, n, pipvt, dummy, n, info)); |
457
|
75 |
1919
|
76 if (f77_exception_encountered) |
|
77 (*current_liboctave_error_handler) ("unrecoverable error in zgesv"); |
|
78 else |
1992
|
79 ipvt -= 1; |
457
|
80 } |
|
81 |
|
82 /* |
|
83 ;;; Local Variables: *** |
|
84 ;;; mode: C++ *** |
|
85 ;;; End: *** |
|
86 */ |