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