GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
lu.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2021 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_lu_h)
27 #define octave_lu_h 1
28 
29 #include "octave-config.h"
30 
31 #include "Array.h"
32 
33 class ColumnVector;
34 class PermMatrix;
35 
36 namespace octave
37 {
38  namespace math
39  {
40  template <typename T>
41  class
42  lu
43  {
44  public:
45 
46  typedef typename T::column_vector_type VT;
47  typedef typename T::element_type ELT_T;
48 
49  lu (void)
50  : a_fact (), l_fact (), ipvt () { }
51 
52  lu (const T& a);
53 
54  lu (const lu& a)
55  : a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { }
56 
57  lu (const T& l, const T& u, const PermMatrix& p);
58 
59  lu& operator = (const lu& a)
60  {
61  if (this != &a)
62  {
63  a_fact = a.a_fact;
64  l_fact = a.l_fact;
65  ipvt = a.ipvt;
66  }
67 
68  return *this;
69  }
70 
71  virtual ~lu (void) = default;
72 
73  bool packed (void) const;
74 
75  void unpack (void);
76 
77  T L (void) const;
78 
79  T U (void) const;
80 
81  T Y (void) const;
82 
83  PermMatrix P (void) const;
84 
85  ColumnVector P_vec (void) const;
86 
87  bool regular (void) const;
88 
89  void update (const VT& u, const VT& v);
90 
91  void update (const T& u, const T& v);
92 
93  void update_piv (const VT& u, const VT& v);
94 
95  void update_piv (const T& u, const T& v);
96 
97  protected:
98 
99  // The result of getp is passed to other Octave Matrix functions,
100  // so we use octave_idx_type.
101  Array<octave_idx_type> getp (void) const;
102 
105 
106  // This is internal storage that is passed to Fortran,
107  // so we need a Fortran INTEGER.
109  };
110  }
111 }
112 
113 #endif
lu(void)
Definition: lu.h:49
T::column_vector_type VT
Definition: lu.h:46
void update(const T &u, const T &v)
void update(const VT &u, const VT &v)
Array< octave_f77_int_type > ipvt
Definition: lu.h:108
lu(const T &a)
void update_piv(const T &u, const T &v)
T::element_type ELT_T
Definition: lu.h:47
lu(const lu &a)
Definition: lu.h:54
void update_piv(const VT &u, const VT &v)
virtual ~lu(void)=default