GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
fDiagMatrix.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1994-2025 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_fDiagMatrix_h)
27#define octave_fDiagMatrix_h 1
28
29#include "octave-config.h"
30
31#include "DET.h"
32#include "MDiagArray2.h"
33#include "fColVector.h"
34#include "fRowVector.h"
35#include "mx-defs.h"
36
38{
39public:
40
42
43 FloatDiagMatrix () = default;
44
45 FloatDiagMatrix (const FloatDiagMatrix& a) = default;
46
48
49 ~FloatDiagMatrix () = default;
50
53
55 : MDiagArray2<float> (r, c, val) { }
56
58
59 template <typename U>
61
62 explicit FloatDiagMatrix (const Array<double>& a) : MDiagArray2<float> (a) { }
63
66
67 OCTAVE_API bool operator == (const FloatDiagMatrix& a) const;
68 OCTAVE_API bool operator != (const FloatDiagMatrix& a) const;
69
70 OCTAVE_API FloatDiagMatrix& fill (float val);
72 fill (float val, octave_idx_type beg, octave_idx_type end);
78 fill (const FloatRowVector& a, octave_idx_type beg);
79
82
84
87
88 // resize is the destructive analog for this one
89
91 extract (octave_idx_type r1, octave_idx_type c1,
92 octave_idx_type r2, octave_idx_type c2) const;
93
94 // extract row or column i.
95
97 OCTAVE_API FloatRowVector row (char *s) const;
98
100 OCTAVE_API FloatColumnVector column (char *s) const;
101
102 OCTAVE_API FloatDiagMatrix inverse () const;
103 OCTAVE_API FloatDiagMatrix inverse (octave_idx_type& info) const;
104 OCTAVE_API FloatDiagMatrix pseudo_inverse (float tol = 0.0f) const;
105
106 // other operations
107
110
111 OCTAVE_API FloatDET determinant () const;
112 OCTAVE_API float rcond () const;
113
114 // i/o
115
116 friend OCTAVE_API std::ostream&
117 operator << (std::ostream& os, const FloatDiagMatrix& a);
118
119};
120
123
124// diagonal matrix by diagonal matrix -> diagonal matrix operations
125
128
130
131#endif
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MDIAGARRAY2_FORWARD_DEFS(B, R, T)
N Dimensional Array with copy-on-write semantics.
Definition Array.h:130
Array< T, Alloc > column(octave_idx_type k) const
Extract column: A(:,k+1).
void fill(const T &val)
Definition Array-base.cc:96
Array< T > extract_diag(octave_idx_type k=0) const
Definition DiagArray2.cc:48
FloatDiagMatrix(octave_idx_type r, octave_idx_type c)
Definition fDiagMatrix.h:51
FloatDiagMatrix(const DiagArray2< U > &a)
Definition fDiagMatrix.h:60
FloatDiagMatrix transpose() const
Definition fDiagMatrix.h:80
FloatMatrix full_matrix_type
Definition fDiagMatrix.h:41
~FloatDiagMatrix()=default
FloatColumnVector extract_diag(octave_idx_type k=0) const
FloatDiagMatrix(const MDiagArray2< float > &a)
Definition fDiagMatrix.h:57
FloatDiagMatrix(const Array< double > &a)
Definition fDiagMatrix.h:62
FloatDiagMatrix()=default
FloatDiagMatrix(const Array< float > &a, octave_idx_type r, octave_idx_type c)
Definition fDiagMatrix.h:64
FloatDiagMatrix(const FloatDiagMatrix &a)=default
FloatDiagMatrix(octave_idx_type r, octave_idx_type c, float val)
Definition fDiagMatrix.h:54
Template for two dimensional diagonal array with math operators.
Definition MDiagArray2.h:54
MDiagArray2< T > & operator=(const MDiagArray2< T > &a)
Definition MDiagArray2.h:78
MDiagArray2< T > transpose() const
Definition DET.h:38
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition dim-vector.h:532
bool operator==(const dim_vector &a, const dim_vector &b)
Definition dim-vector.h:516
FloatDiagMatrix real(const FloatComplexDiagMatrix &a)
FloatDiagMatrix operator*(const FloatDiagMatrix &a, const FloatDiagMatrix &b)
FloatDiagMatrix imag(const FloatComplexDiagMatrix &a)
#define OCTAVE_API
Definition main.in.cc:55
template int8_t abs(int8_t)