GNU Octave  8.1.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-2023 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 "mx-fwd.h"
32 
33 #include "Array.h"
34 
36 
38 
39 template <typename T>
40 class
41 lu
42 {
43 public:
44 
45  typedef typename T::column_vector_type VT;
46  typedef typename T::element_type ELT_T;
47 
48  lu (void)
49  : m_a_fact (), m_L (), m_ipvt () { }
50 
51  OCTAVE_API lu (const T& a);
52 
53  lu (const lu& a)
54  : m_a_fact (a.m_a_fact), m_L (a.m_L), m_ipvt (a.m_ipvt) { }
55 
56  OCTAVE_API lu (const T& l, const T& u, const PermMatrix& p);
57 
58  lu& operator = (const lu& a)
59  {
60  if (this != &a)
61  {
62  m_a_fact = a.m_a_fact;
63  m_L = a.m_L;
64  m_ipvt = a.m_ipvt;
65  }
66 
67  return *this;
68  }
69 
70  virtual ~lu (void) = default;
71 
72  OCTAVE_API bool packed (void) const;
73 
74  OCTAVE_API void unpack (void);
75 
76  OCTAVE_API T L (void) const;
77 
78  OCTAVE_API T U (void) const;
79 
80  OCTAVE_API T Y (void) const;
81 
82  OCTAVE_API PermMatrix P (void) const;
83 
84  OCTAVE_API ColumnVector P_vec (void) const;
85 
86  OCTAVE_API bool regular (void) const;
87 
88  OCTAVE_API void update (const VT& u, const VT& v);
89 
90  OCTAVE_API void update (const T& u, const T& v);
91 
92  OCTAVE_API void update_piv (const VT& u, const VT& v);
93 
94  OCTAVE_API void update_piv (const T& u, const T& v);
95 
96 protected:
97 
98  // The result of getp is passed to other Octave Matrix functions,
99  // so we use octave_idx_type.
100  OCTAVE_API Array<octave_idx_type> getp (void) const;
101 
103  T m_L;
104 
105  // This is internal storage that is passed to Fortran,
106  // so we need a Fortran INTEGER.
108 };
109 
112 
113 #endif
OCTAVE_END_NAMESPACE(octave)
Definition: lu.h:42
virtual ~lu(void)=default
OCTAVE_API void update(const VT &u, const VT &v)
T m_L
Definition: lu.h:103
OCTAVE_API void update_piv(const VT &u, const VT &v)
lu(const lu &a)
Definition: lu.h:53
Array< octave_f77_int_type > m_ipvt
Definition: lu.h:107
OCTAVE_API void update(const T &u, const T &v)
lu(void)
Definition: lu.h:48
T::column_vector_type VT
Definition: lu.h:45
OCTAVE_API lu(const T &a)
T::element_type ELT_T
Definition: lu.h:46
OCTAVE_API void update_piv(const T &u, const T &v)
T m_a_fact
Definition: lu.h:102
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition: main.in.cc:55