GNU Octave  9.1.0
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) 1998-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_sparse_chol_h)
27 #define octave_sparse_chol_h 1
28 
29 #include "octave-config.h"
30 
31 #include <memory>
32 
33 #include "mx-fwd.h"
34 
35 #include "CSparse.h"
36 
38 
40 
41 // If the sparse matrix classes become templated on the element type
42 // (i.e., sparse_matrix<double>), then it might be best to make the
43 // template parameter of this class also be the element type instead
44 // of the matrix type.
45 
46 template <typename chol_type>
47 class
50 {
51 public:
52 
53  sparse_chol ();
54 
55  sparse_chol (const chol_type& a, bool natural, bool force);
56 
57  sparse_chol (const chol_type& a, octave_idx_type& info,
58  bool natural, bool force);
59 
60  sparse_chol (const chol_type& a, octave_idx_type& info, bool natural);
61 
62  sparse_chol (const chol_type& a, octave_idx_type& info);
63 
64  sparse_chol (const sparse_chol<chol_type>& a) = default;
65 
66  virtual ~sparse_chol () = default;
67 
69  operator = (const sparse_chol<chol_type>& a) = default;
70 
71  chol_type L () const;
72 
73  chol_type R () const { return L ().hermitian (); }
74 
75  octave_idx_type P () const;
76 
77  RowVector perm () const;
78 
79  SparseMatrix Q () const;
80 
81  bool is_positive_definite () const;
82 
83  double rcond () const;
84 
85  chol_type inverse () const;
86 
87 protected:
88 
89  typedef typename chol_type::element_type chol_elt;
90 
91  class sparse_chol_rep;
92 
93 private:
94 
95  std::shared_ptr<sparse_chol_rep> m_rep;
96 };
97 
98 template <typename chol_type>
100 chol_type
101 chol2inv (const chol_type& r);
102 
103 OCTAVE_END_NAMESPACE(math)
104 OCTAVE_END_NAMESPACE(octave)
105 
106 #endif
chol_type R() const
Definition: sparse-chol.h:73
virtual ~sparse_chol()=default
chol_type::element_type chol_elt
Definition: sparse-chol.h:89
sparse_chol(const sparse_chol< chol_type > &a)=default
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
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
#define OCTAVE_API
Definition: main.cc:55
T * r
Definition: mx-inlines.cc:781
chol_type chol2inv(const chol_type &r)
Definition: sparse-chol.cc:516