GNU Octave  4.4.1
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-2018 John W. Eaton
4 Copyright (C) 2009 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software: you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_lu_h)
25 #define octave_lu_h 1
26 
27 #include "octave-config.h"
28 
29 #include "Array.h"
30 
31 class ColumnVector;
32 class PermMatrix;
33 
34 namespace octave
35 {
36  namespace math
37  {
38  template <typename T>
39  class
40  lu
41  {
42  public:
43 
44  typedef typename T::column_vector_type VT;
45  typedef typename T::element_type ELT_T;
46 
47  lu (void)
48  : a_fact (), l_fact (), ipvt () { }
49 
50  lu (const T& a);
51 
52  lu (const lu& a)
53  : a_fact (a.a_fact), l_fact (a.l_fact), ipvt (a.ipvt) { }
54 
55  lu (const T& l, const T& u, const PermMatrix& p);
56 
57  lu& operator = (const lu& a)
58  {
59  if (this != &a)
60  {
61  a_fact = a.a_fact;
62  l_fact = a.l_fact;
63  ipvt = a.ipvt;
64  }
65 
66  return *this;
67  }
68 
69  virtual ~lu (void) = default;
70 
71  bool packed (void) const;
72 
73  void unpack (void);
74 
75  T L (void) const;
76 
77  T U (void) const;
78 
79  T Y (void) const;
80 
81  PermMatrix P (void) const;
82 
83  ColumnVector P_vec (void) const;
84 
85  bool regular (void) const;
86 
87  void update (const VT& u, const VT& v);
88 
89  void update (const T& u, const T& v);
90 
91  void update_piv (const VT& u, const VT& v);
92 
93  void update_piv (const T& u, const T& v);
94 
95  protected:
96 
97  // The result of getp is passed to other Octave Matrix functions,
98  // so we use octave_idx_type.
99  Array<octave_idx_type> getp (void) const;
100 
103 
104  // This is internal storage that is passed to Fortran,
105  // so we need a Fortran INTEGER.
107  };
108  }
109 }
110 
111 #endif
T::column_vector_type VT
Definition: lu.h:44
u
Definition: lu.cc:138
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
Array< octave_f77_int_type > ipvt
Definition: lu.h:106
lu(void)
Definition: lu.h:47
T::element_type ELT_T
Definition: lu.h:45
p
Definition: lu.cc:138
lu(const lu &a)
Definition: lu.h:52