annotate liboctave/CmplxLU.cc @ 7016:93c65f2a5668

[project @ 2007-10-12 06:40:56 by jwe]
author jwe
date Fri, 12 Oct 2007 06:41:26 +0000
parents 4c8a2e4e0717
children a1dbe9d80eee
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
2847
8b262e771614 [project @ 1997-03-27 16:18:26 by jwe]
jwe
parents: 2804
diff changeset
3 Copyright (C) 1996, 1997 John W. Eaton
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
4
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
6
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
7 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
8 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
9 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
10 option) any later version.
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
11
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
12 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
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
14 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
15 for more details.
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
16
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
17 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
18 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
19 <http://www.gnu.org/licenses/>.
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
20
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 #ifdef HAVE_CONFIG_H
1192
b6360f2d4fa6 [project @ 1995-03-30 21:38:35 by jwe]
jwe
parents: 1011
diff changeset
24 #include <config.h>
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
25 #endif
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
26
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
27 #include "CmplxLU.h"
1847
2ffe49eb95a5 [project @ 1996-02-03 12:47:55 by jwe]
jwe
parents: 1368
diff changeset
28 #include "f77-fcn.h"
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
29 #include "lo-error.h"
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
30
1992
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
31 // 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
32
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
33 #include <base-lu.h>
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
34 #include <base-lu.cc>
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
35
2049
468a96dd03fc [project @ 1996-03-29 20:09:05 by jwe]
jwe
parents: 1993
diff changeset
36 template class base_lu <ComplexMatrix, Complex, Matrix, double>;
1992
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
37
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
38 // Define the constructor for this particular derivation.
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
39
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
40 extern "C"
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
41 {
4552
6f3382e08a52 [project @ 2003-10-27 20:38:02 by jwe]
jwe
parents: 4329
diff changeset
42 F77_RET_T
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
43 F77_FUNC (zgetrf, ZGETRF) (const octave_idx_type&, const octave_idx_type&, Complex*,
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
44 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
45 }
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 ComplexLU::ComplexLU (const ComplexMatrix& a)
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
48 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
49 octave_idx_type a_nr = a.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
50 octave_idx_type a_nc = a.cols ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
51 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
52
4329
d53c33d93440 [project @ 2003-02-18 20:00:48 by jwe]
jwe
parents: 4192
diff changeset
53 ipvt.resize (mn);
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
54 octave_idx_type *pipvt = ipvt.fortran_vec ();
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
55
1992
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
56 a_fact = a;
5668c00f9c7a [project @ 1996-03-03 00:40:53 by jwe]
jwe
parents: 1926
diff changeset
57 Complex *tmp_data = a_fact.fortran_vec ();
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
58
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
59 octave_idx_type info = 0;
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
60
4329
d53c33d93440 [project @ 2003-02-18 20:00:48 by jwe]
jwe
parents: 4192
diff changeset
61 F77_XFCN (zgetrf, ZGETRF, (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
62
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
63 if (f77_exception_encountered)
4329
d53c33d93440 [project @ 2003-02-18 20:00:48 by jwe]
jwe
parents: 4192
diff changeset
64 (*current_liboctave_error_handler) ("unrecoverable error in zgetrf");
1919
b582f7f765e0 [project @ 1996-02-11 01:58:47 by jwe]
jwe
parents: 1882
diff changeset
65 else
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 5105
diff changeset
66 ipvt -= static_cast<octave_idx_type> (1);
457
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
67 }
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 ;;; Local Variables: ***
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
71 ;;; mode: C++ ***
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
72 ;;; End: ***
3d4b4f0fa5ba [project @ 1994-06-06 00:33:33 by jwe]
jwe
parents:
diff changeset
73 */