GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
sparse-lu.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2016-2017 John W. Eaton
4 Copyright (C) 2004-2016 David Bateman
5 Copyright (C) 1998-2004 Andy Adler
6 
7 This file is part of Octave.
8 
9 Octave is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the
11 Free Software Foundation; either version 3 of the License, or (at your
12 option) any later version.
13 
14 Octave is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Octave; see the file COPYING. If not, see
21 <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 #if ! defined (octave_sparse_lu_h)
26 #define octave_sparse_lu_h 1
27 
28 #include "octave-config.h"
29 
30 #include "MArray.h"
31 #include "dSparse.h"
32 
33 namespace octave
34 {
35  namespace math
36  {
37  // If the sparse matrix classes become templated on the element type
38  // (i.e., sparse_matrix<double>), then it might be best to make the
39  // template parameter of this class also be the element type instead
40  // of the matrix type.
41 
42  template <typename lu_type>
43  class
44  sparse_lu
45  {
46  public:
47 
48  typedef typename lu_type::element_type lu_elt_type;
49 
50  sparse_lu (void)
51  : Lfact (), Ufact (), Rfact (), cond (0), P (), Q () { }
52 
53  sparse_lu (const lu_type& a, const Matrix& piv_thres = Matrix (),
54  bool scale = false);
55 
56  sparse_lu (const lu_type& a, const ColumnVector& Qinit,
57  const Matrix& piv_thres, bool scale = false,
58  bool FixedQ = false, double droptol = -1.0,
59  bool milu = false, bool udiag = false);
60 
61  sparse_lu (const sparse_lu& a)
62  : Lfact (a.Lfact), Ufact (a.Ufact), Rfact (), cond (a.cond),
63  P (a.P), Q (a.Q)
64  { }
65 
66  sparse_lu& operator = (const sparse_lu& a)
67  {
68  if (this != &a)
69  {
70  Lfact = a.Lfact;
71  Ufact = a.Ufact;
72  cond = a.cond;
73  P = a.P;
74  Q = a.Q;
75  }
76 
77  return *this;
78  }
79 
80  virtual ~sparse_lu (void) { }
81 
82  lu_type L (void) const { return Lfact; }
83 
84  lu_type U (void) const { return Ufact; }
85 
86  SparseMatrix R (void) const { return Rfact; }
87 
88  lu_type Y (void) const;
89 
90  SparseMatrix Pc (void) const;
91 
92  SparseMatrix Pr (void) const;
93 
94  ColumnVector Pc_vec (void) const;
95 
96  ColumnVector Pr_vec (void) const;
97 
98  PermMatrix Pc_mat (void) const;
99 
100  PermMatrix Pr_mat (void) const;
101 
102  const octave_idx_type * row_perm (void) const { return P.fortran_vec (); }
103 
104  const octave_idx_type * col_perm (void) const { return Q.fortran_vec (); }
105 
106  double rcond (void) const { return cond; }
107 
108  protected:
109 
110  lu_type Lfact;
111  lu_type Ufact;
113 
114  double cond;
115 
118  };
119  }
120 }
121 
122 #endif
lu_type::element_type lu_elt_type
Definition: sparse-lu.h:48
MArray< octave_idx_type > Q
Definition: sparse-lu.h:117
Octave interface to the compression and uncompression libraries.
Definition: aepbalance.cc:47
ar P
Definition: __luinc__.cc:49
lu_type L(void) const
Definition: sparse-lu.h:82
const octave_idx_type * col_perm(void) const
Definition: sparse-lu.h:104
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup calculate Y_a and Y _d item Given Y
Definition: DASPK-opts.cc:739
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
const octave_idx_type * row_perm(void) const
Definition: sparse-lu.h:102
SparseMatrix R(void) const
Definition: sparse-lu.h:86
Definition: dMatrix.h:37
SparseMatrix Rfact
Definition: sparse-lu.h:112
sparse_lu(const sparse_lu &a)
Definition: sparse-lu.h:61
void scale(Matrix &m, double x, double y, double z)
Definition: graphics.cc:5150
double rcond(void) const
Definition: sparse-lu.h:106
MArray< octave_idx_type > P
Definition: sparse-lu.h:116
lu_type U(void) const
Definition: sparse-lu.h:84
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Q
virtual ~sparse_lu(void)
Definition: sparse-lu.h:80