1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1994-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_hess_h)
27 #define octave_hess_h 1
28 
29 #include "octave-config.h"
30 
31 #include <iosfwd>
32 
33 namespace octave
34 {
35   namespace math
36   {
37     template <typename T>
38     class
39     hess
40     {
41     public:
42 
hess(void)43       hess (void)
44         : hess_mat (), unitary_hess_mat ()
45       { }
46 
hess(const T & a)47       hess (const T& a)
48         : hess_mat (), unitary_hess_mat ()
49       {
50         init (a);
51       }
52 
hess(const T & a,octave_idx_type & info)53       hess (const T& a, octave_idx_type& info)
54         : hess_mat (), unitary_hess_mat ()
55       {
56         info = init (a);
57       }
58 
hess(const hess & a)59       hess (const hess& a)
60         : hess_mat (a.hess_mat), unitary_hess_mat (a.unitary_hess_mat)
61       { }
62 
63       hess& operator = (const hess& a)
64       {
65         if (this != &a)
66           {
67             hess_mat = a.hess_mat;
68             unitary_hess_mat = a.unitary_hess_mat;
69           }
70 
71         return *this;
72       }
73 
74       ~hess (void) = default;
75 
hess_matrix(void)76       T hess_matrix (void) const { return hess_mat; }
77 
unitary_hess_matrix(void)78       T unitary_hess_matrix (void) const { return unitary_hess_mat; }
79 
80     private:
81 
82       T hess_mat;
83       T unitary_hess_mat;
84 
85       octave_idx_type init (const T& a);
86     };
87 
88     template <typename T>
89     extern std::ostream&
90     operator << (std::ostream& os, const hess<T>& a);
91   }
92 }
93 
94 #endif
95