457
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
457
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
1192
|
25 #include <config.h> |
457
|
26 #endif |
|
27 |
|
28 #include "dbleLU.h" |
1847
|
29 #include "f77-fcn.h" |
457
|
30 #include "lo-error.h" |
|
31 |
1992
|
32 // Instantiate the base LU class for the types we need. |
|
33 |
|
34 #include <base-lu.h> |
|
35 #include <base-lu.cc> |
|
36 |
2049
|
37 template class base_lu <Matrix, double, Matrix, double>; |
1992
|
38 |
|
39 // Define the constructor for this particular derivation. |
|
40 |
457
|
41 extern "C" |
|
42 { |
4552
|
43 F77_RET_T |
5275
|
44 F77_FUNC (dgetrf, DGETRF) (const octave_idx_type&, const octave_idx_type&, double*, |
|
45 const octave_idx_type&, octave_idx_type*, octave_idx_type&); |
457
|
46 } |
|
47 |
|
48 LU::LU (const Matrix& a) |
|
49 { |
5275
|
50 octave_idx_type a_nr = a.rows (); |
|
51 octave_idx_type a_nc = a.cols (); |
|
52 octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc); |
1919
|
53 |
4329
|
54 ipvt.resize (mn); |
5275
|
55 octave_idx_type *pipvt = ipvt.fortran_vec (); |
1919
|
56 |
1992
|
57 a_fact = a; |
|
58 double *tmp_data = a_fact.fortran_vec (); |
1919
|
59 |
5275
|
60 octave_idx_type info = 0; |
457
|
61 |
4329
|
62 F77_XFCN (dgetrf, DGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info)); |
457
|
63 |
1919
|
64 if (f77_exception_encountered) |
4329
|
65 (*current_liboctave_error_handler) ("unrecoverable error in dgetrf"); |
1919
|
66 else |
5275
|
67 ipvt -= static_cast<octave_idx_type> (1); |
457
|
68 } |
|
69 |
|
70 /* |
|
71 ;;; Local Variables: *** |
|
72 ;;; mode: C++ *** |
|
73 ;;; End: *** |
|
74 */ |