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_gepbalance_h)
27 #define octave_gepbalance_h 1
28 
29 #include "octave-config.h"
30 
31 #include <string>
32 
33 namespace octave
34 {
35   namespace math
36   {
37     template <typename T>
38     class
39     gepbalance
40     {
41     public:
42 
43       typedef typename T::real_matrix_type RT;
44 
gepbalance(void)45       gepbalance (void)
46         : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ()
47       { }
48 
gepbalance(const T & a,const T & b,const std::string & job)49       gepbalance (const T& a, const T& b, const std::string& job)
50         : balanced_mat (), balanced_mat2 (), balancing_mat (), balancing_mat2 ()
51       {
52         init (a, b, job);
53       }
54 
gepbalance(const gepbalance & a)55       gepbalance (const gepbalance& a)
56         : balanced_mat (a.balanced_mat), balanced_mat2 (a.balanced_mat2),
57           balancing_mat (a.balancing_mat), balancing_mat2 (a.balancing_mat2)
58       { }
59 
60       gepbalance& operator = (const gepbalance& a)
61       {
62         if (this != &a)
63           {
64             balanced_mat = a.balanced_mat;
65             balanced_mat2 = a.balanced_mat2;
66             balancing_mat = a.balancing_mat;
67             balancing_mat2 = a.balancing_mat2;
68           }
69 
70         return *this;
71       }
72 
73       ~gepbalance (void) = default;
74 
balanced_matrix(void)75       T balanced_matrix (void) const { return balanced_mat; }
76 
balanced_matrix2(void)77       T balanced_matrix2 (void) const { return balanced_mat2; }
78 
balancing_matrix(void)79       RT balancing_matrix (void) const { return balancing_mat; }
80 
balancing_matrix2(void)81       RT balancing_matrix2 (void) const { return balancing_mat2; }
82 
83     private:
84 
85       T balanced_mat;
86       T balanced_mat2;
87       RT balancing_mat;
88       RT balancing_mat2;
89 
90       octave_idx_type init (const T& a, const T& b, const std::string& job);
91     };
92   }
93 }
94 
95 #endif
96