GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
aepbalance.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1994-2026 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_aepbalance_h)
27#define octave_aepbalance_h 1
28
29#include "octave-config.h"
30
31#include <algorithm>
32
35
36template <typename MT>
38{
39public:
40
41 typedef typename MT::real_column_vector_type VT;
42
43 aepbalance () : m_balanced_mat (), m_scale (), m_ilo (), m_ihi (), m_job () { }
44
45 OCTAVE_API aepbalance (const MT& a, bool noperm = false, bool noscal = false);
46
51
53 {
54 if (this != &a)
55 {
57 m_scale = a.m_scale;
58 m_ilo = a.m_ilo;
59 m_ihi = a.m_ihi;
60 m_job = a.m_job;
61 }
62
63 return *this;
64 }
65
66 virtual ~aepbalance () = default;
67
69
70 MT balanced_matrix () const
71 {
72 return m_balanced_mat;
73 }
74
76 {
78
79 VT pv (n);
80
81 for (octave_idx_type i = 0; i < n; i++)
82 pv(i) = i+1;
83
84 for (octave_idx_type i = n-1; i >= m_ihi; i--)
85 {
86 octave_idx_type j = m_scale(i) - 1;
87 std::swap (pv(i), pv(j));
88 }
89
90 for (octave_idx_type i = 0; i < m_ilo-1; i++)
91 {
92 octave_idx_type j = m_scale(i) - 1;
93 std::swap (pv(i), pv(j));
94 }
95
96 return pv;
97 }
98
100 {
102
103 VT scv (n);
104
105 for (octave_idx_type i = 0; i < m_ilo-1; i++)
106 scv(i) = 1;
107
108 for (octave_idx_type i = m_ilo-1; i < m_ihi; i++)
109 scv(i) = m_scale(i);
110
111 for (octave_idx_type i = m_ihi; i < n; i++)
112 scv(i) = 1;
113
114 return scv;
115 }
116
117protected:
118
123 char m_job;
124};
125
126OCTAVE_END_NAMESPACE(math)
127OCTAVE_END_NAMESPACE(octave)
128
129#endif
VT scaling_vector() const
Definition aepbalance.h:99
virtual ~aepbalance()=default
MT balanced_matrix() const
Definition aepbalance.h:70
octave_idx_type m_ihi
Definition aepbalance.h:122
VT permuting_vector() const
Definition aepbalance.h:75
aepbalance(const aepbalance &a)
Definition aepbalance.h:47
octave_idx_type m_ilo
Definition aepbalance.h:121
aepbalance(const MT &a, bool noperm=false, bool noscal=false)
aepbalance & operator=(const aepbalance &a)
Definition aepbalance.h:52
MT::real_column_vector_type VT
Definition aepbalance.h:41
MT m_balanced_mat
Definition aepbalance.h:119
MT balancing_matrix() const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55