GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
sparse-chol.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2016-2018 John W. Eaton
4 Copyright (C) 2005-2018 David Bateman
5 Copyright (C) 1998-2005 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
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Octave is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License 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 <https://www.gnu.org/licenses/>.
22 
23 */
24 
25 #if ! defined (octave_sparse_chol_h)
26 #define octave_sparse_chol_h 1
27 
28 #include "octave-config.h"
29 
30 class RowVector;
31 class SparseMatrix;
33 
34 namespace octave
35 {
36  namespace math
37  {
38  // If the sparse matrix classes become templated on the element type
39  // (i.e., sparse_matrix<double>), then it might be best to make the
40  // template parameter of this class also be the element type instead
41  // of the matrix type.
42 
43  template <typename chol_type>
44  class
46  {
47  public:
48 
49  sparse_chol (void);
50 
51  sparse_chol (const chol_type& a, bool natural, bool force);
52 
53  sparse_chol (const chol_type& a, octave_idx_type& info,
54  bool natural, bool force);
55 
56  sparse_chol (const chol_type& a, octave_idx_type& info, bool natural);
57 
58  sparse_chol (const chol_type& a, octave_idx_type& info);
59 
61 
62  virtual ~sparse_chol (void);
63 
64  sparse_chol& operator = (const sparse_chol& a);
65 
66  chol_type L (void) const;
67 
68  chol_type R (void) const { return L ().hermitian (); }
69 
70  octave_idx_type P (void) const;
71 
72  RowVector perm (void) const;
73 
74  SparseMatrix Q (void) const;
75 
76  bool is_positive_definite (void) const;
77 
78  double rcond (void) const;
79 
80  chol_type inverse (void) const;
81 
82  protected:
83 
84  typedef typename chol_type::element_type chol_elt;
85 
87 
88  private:
89 
91  };
92 
93  template <typename chol_type>
94  chol_type
95  chol2inv (const chol_type& r);
96 
97  // SparseComplexMatrix specialization.
98 
99  template <>
101  (const SparseComplexMatrix& a, octave_idx_type& info);
102  }
103 }
104 
105 #endif
chol_type::element_type chol_elt
Definition: sparse-chol.h:84
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:400
T chol2inv(const T &r)
Definition: chol.cc:242
sparse_chol_rep * rep
Definition: sparse-chol.h:86
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
chol_type R(void) const
Definition: sparse-chol.h:68