GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
chol.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1994-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_chol_h)
27 #define octave_chol_h 1
28 
29 #include "octave-config.h"
30 
32 
34 
35 template <typename T>
36 class
37 chol
38 {
39 public:
40 
41  typedef typename T::column_vector_type VT;
42  typedef typename T::real_elt_type COND_T;
43 
44  chol () : m_chol_mat (), m_rcond (0), m_is_upper (true) { }
45 
46  chol (const T& a, bool upper = true, bool calc_cond = false)
47  : m_chol_mat (), m_rcond (0)
48  {
49  init (a, upper, calc_cond);
50  }
51 
52  chol (const T& a, octave_idx_type& info, bool upper = true,
53  bool calc_cond = false)
54  : m_chol_mat (), m_rcond (0)
55  {
56  info = init (a, upper, calc_cond);
57  }
58 
59  OCTAVE_DEFAULT_COPY_MOVE_DELETE (chol)
60 
61  T chol_matrix () const { return m_chol_mat; }
62 
63  COND_T rcond () const { return m_rcond; }
64 
65  // Compute the inverse of a matrix using the Cholesky factorization.
66  OCTAVE_API T inverse () const;
67 
68  OCTAVE_API void set (const T& R);
69 
70  OCTAVE_API void update (const VT& u);
71 
73 
75 
77 
79 
80 private:
81 
82  T m_chol_mat;
83 
84  COND_T m_rcond;
85 
86  bool m_is_upper;
87 
88  OCTAVE_API octave_idx_type init (const T& a, bool upper, bool calc_cond);
89 };
90 
91 template <typename T>
92 OCTAVE_API T
93 chol2inv (const T& r);
94 
95 OCTAVE_END_NAMESPACE(math)
96 OCTAVE_END_NAMESPACE(octave)
97 
98 #endif
T chol2inv(const T &r)
Definition: chol.cc:242
Definition: chol.h:38
COND_T rcond() const
Definition: chol.h:63
void shift_sym(octave_idx_type i, octave_idx_type j)
chol()
Definition: chol.h:44
void delete_sym(octave_idx_type j)
T::column_vector_type VT
Definition: chol.h:41
chol(const T &a, octave_idx_type &info, bool upper=true, bool calc_cond=false)
Definition: chol.h:52
octave_idx_type insert_sym(const VT &u, octave_idx_type j)
octave_idx_type downdate(const VT &u)
void update(const VT &u)
chol(const T &a, bool upper=true, bool calc_cond=false)
Definition: chol.h:46
T::real_elt_type COND_T
Definition: chol.h:42
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition: main.cc:55
T * r
Definition: mx-inlines.cc:781