GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
chol.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1994-2025 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
35template <typename T>
36class chol
37{
38public:
39
40 typedef typename T::column_vector_type VT;
41 typedef typename T::real_elt_type COND_T;
42
43 chol () : m_chol_mat (), m_rcond (0), m_is_upper (true) { }
44
45 chol (const T& a, bool upper = true, bool calc_cond = false)
46 : m_chol_mat (), m_rcond (0)
47 {
48 init (a, upper, calc_cond);
49 }
50
51 chol (const T& a, octave_idx_type& info, bool upper = true,
52 bool calc_cond = false)
53 : m_chol_mat (), m_rcond (0)
54 {
55 info = init (a, upper, calc_cond);
56 }
57
58 OCTAVE_DEFAULT_COPY_MOVE_DELETE (chol)
59
60 T chol_matrix () const { return m_chol_mat; }
61
62 COND_T rcond () const { return m_rcond; }
63
64 // Compute the inverse of a matrix using the Cholesky factorization.
65 OCTAVE_API T inverse () const;
66
67 OCTAVE_API void set (const T& R);
68
69 OCTAVE_API void update (const VT& u);
70
72
74
76
78
79private:
80
81 T m_chol_mat;
82
83 COND_T m_rcond;
84
85 bool m_is_upper;
86
87 OCTAVE_API octave_idx_type init (const T& a, bool upper, bool calc_cond);
88};
89
90template <typename T>
92chol2inv (const T& r);
93
94OCTAVE_END_NAMESPACE(math)
95OCTAVE_END_NAMESPACE(octave)
96
97#endif
T chol2inv(const T &r)
Definition chol.cc:242
Definition chol.h:37
void set(const T &R)
Definition chol.cc:257
COND_T rcond() const
Definition chol.h:62
T chol_matrix() const
Definition chol.h:60
void shift_sym(octave_idx_type i, octave_idx_type j)
chol()
Definition chol.h:43
void delete_sym(octave_idx_type j)
T::column_vector_type VT
Definition chol.h:40
chol(const T &a, octave_idx_type &info, bool upper=true, bool calc_cond=false)
Definition chol.h:51
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:45
T inverse() const
Definition chol.cc:250
T::real_elt_type COND_T
Definition chol.h:41
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55