GNU Octave 11.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-2026 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
33
34template <typename T>
35class chol
36{
37public:
38
39 typedef typename T::column_vector_type VT;
40 typedef typename T::real_elt_type COND_T;
41
42 chol () : m_chol_mat (), m_rcond (0), m_is_upper (true) { }
43
44 chol (const T& a, bool upper = true, bool calc_cond = false)
45 : m_chol_mat (), m_rcond (0)
46 {
47 init (a, upper, calc_cond);
48 }
49
50 chol (const T& a, octave_idx_type& info, bool upper = true,
51 bool calc_cond = false)
52 : m_chol_mat (), m_rcond (0)
53 {
54 info = init (a, upper, calc_cond);
55 }
56
57 OCTAVE_DEFAULT_COPY_MOVE_DELETE (chol)
58
59 T chol_matrix () const { return m_chol_mat; }
60
61 COND_T rcond () const { return m_rcond; }
62
63 // Compute the inverse of a matrix using the Cholesky factorization.
64 OCTAVE_API T inverse () const;
65
66 OCTAVE_API void set (const T& R);
67
68 OCTAVE_API void update (const VT& u);
69
71
73
75
77
78private:
79
80 T m_chol_mat;
81
82 COND_T m_rcond;
83
84 bool m_is_upper;
85
86 OCTAVE_API octave_idx_type init (const T& a, bool upper, bool calc_cond);
87};
88
89template <typename T>
91chol2inv (const T& r);
92
93OCTAVE_END_NAMESPACE(math)
94OCTAVE_END_NAMESPACE(octave)
95
96#endif
T chol2inv(const T &r)
Definition chol.cc:124
Definition chol.h:36
void set(const T &R)
Definition chol.cc:139
COND_T rcond() const
Definition chol.h:61
T chol_matrix() const
Definition chol.h:59
void shift_sym(octave_idx_type i, octave_idx_type j)
chol()
Definition chol.h:42
void delete_sym(octave_idx_type j)
T::column_vector_type VT
Definition chol.h:39
chol(const T &a, octave_idx_type &info, bool upper=true, bool calc_cond=false)
Definition chol.h:50
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:44
T inverse() const
Definition chol.cc:132
T::real_elt_type COND_T
Definition chol.h:40
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55