annotate liboctave/dbleLU.cc @ 7334:274d9642ac10 release-3-0-0

[project @ 2007-12-22 01:42:45 by jwe]
author jwe
date Sat, 22 Dec 2007 01:42:46 +0000
parents a1dbe9d80eee
children 29980c6b8604
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
1 /*
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
2
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
3 Copyright (C) 1994, 1995, 1996, 1997, 1999, 2002, 2003, 2004, 2005,
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
4 2007 John W. Eaton
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
5
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
7
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
10 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
11 option) any later version.
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
12
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
16 for more details.
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
17
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5307
diff changeset
20 <http://www.gnu.org/licenses/>.
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
21
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
22 */
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
23
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
1192
b6360f2d4fa6 [project @ 1995-03-30 21:38:35 by jwe]
jwe
parents: 1011
diff changeset
25 #include <config.h>
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
26 #endif
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
27
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
28 #include "dbleLU.h"
1847
2ffe49eb95a5 [project @ 1996-02-03 12:47:55 by jwe]
jwe
parents: 1368
diff changeset
29 #include "f77-fcn.h"
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
30 #include "lo-error.h"
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
31
1992
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
32 // Instantiate the base LU class for the types we need.
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
33
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
34 #include <base-lu.h>
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
35 #include <base-lu.cc>
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
36
2049
468a96dd03fc [project @ 1996-03-29 20:09:05 by jwe]
jwe
parents: 1993
diff changeset
37 template class base_lu <Matrix, double, Matrix, double>;
1992
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
38
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
39 // Define the constructor for this particular derivation.
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
40
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
41 extern "C"
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
42 {
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4329
diff changeset
43 F77_RET_T
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
44 F77_FUNC (dgetrf, DGETRF) (const octave_idx_type&, const octave_idx_type&, double*,
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
45 const octave_idx_type&, octave_idx_type*, octave_idx_type&);
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
46 }
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
47
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
48 LU::LU (const Matrix& a)
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
49 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
50 octave_idx_type a_nr = a.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
51 octave_idx_type a_nc = a.cols ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
52 octave_idx_type mn = (a_nr < a_nc ? a_nr : a_nc);
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
53
4329
d53c33d93440 [project @ 2003-02-18 20:00:48 by jwe]
jwe
parents: 4192
diff changeset
54 ipvt.resize (mn);
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
55 octave_idx_type *pipvt = ipvt.fortran_vec ();
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
56
1992
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
57 a_fact = a;
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
58 double *tmp_data = a_fact.fortran_vec ();
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
59
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
60 octave_idx_type info = 0;
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
61
4329
d53c33d93440 [project @ 2003-02-18 20:00:48 by jwe]
jwe
parents: 4192
diff changeset
62 F77_XFCN (dgetrf, DGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
63
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
64 if (f77_exception_encountered)
4329
d53c33d93440 [project @ 2003-02-18 20:00:48 by jwe]
jwe
parents: 4192
diff changeset
65 (*current_liboctave_error_handler) ("unrecoverable error in dgetrf");
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
66 else
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
67 ipvt -= static_cast<octave_idx_type> (1);
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
68 }
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
69
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
70 /*
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
71 ;;; Local Variables: ***
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
72 ;;; mode: C++ ***
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
73 ;;; End: ***
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
74 */