GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
fColVector.h
Go to the documentation of this file.
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_fColVector_h)
27 #define octave_fColVector_h 1
28 
29 #include "octave-config.h"
30 
31 #include "MArray.h"
32 #include "mx-defs.h"
33 
34 class
35 OCTAVE_API
37 {
38 public:
39 
40  FloatColumnVector (void) : MArray<float> (dim_vector (0, 1)) { }
41 
43  : MArray<float> (dim_vector (n, 1)) { }
44 
45  explicit FloatColumnVector (const dim_vector& dv)
46  : MArray<float> (dv.as_column ()) { }
47 
49  : MArray<float> (dim_vector (n, 1), val) { }
50 
51  FloatColumnVector (const FloatColumnVector& a) : MArray<float> (a) { }
52 
54  : MArray<float> (a.as_column ()) { }
55 
57  : MArray<float> (a.as_column ()) { }
58 
59  FloatColumnVector& operator = (const FloatColumnVector& a)
60  {
62  return *this;
63  }
64 
65  bool operator == (const FloatColumnVector& a) const;
66  bool operator != (const FloatColumnVector& a) const;
67 
68  // destructive insert/delete/reorder operations
69 
71 
72  FloatColumnVector& fill (float val);
73  FloatColumnVector& fill (float val, octave_idx_type r1, octave_idx_type r2);
74 
75  FloatColumnVector stack (const FloatColumnVector& a) const;
76 
77  FloatRowVector transpose (void) const;
78 
79  friend OCTAVE_API FloatColumnVector real (const FloatComplexColumnVector& a);
80  friend OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a);
81 
82  // resize is the destructive equivalent for this one
83 
84  FloatColumnVector extract (octave_idx_type r1, octave_idx_type r2) const;
85 
86  FloatColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const;
87 
88  // matrix by column vector -> column vector operations
89 
90  friend OCTAVE_API FloatColumnVector operator * (const FloatMatrix& a,
91  const FloatColumnVector& b);
92 
93  // diagonal matrix by column vector -> column vector operations
94 
95  friend OCTAVE_API FloatColumnVector operator * (const FloatDiagMatrix& a,
96  const FloatColumnVector& b);
97 
98  // other operations
99 
100  float min (void) const;
101  float max (void) const;
102 
103  FloatColumnVector abs (void) const;
104 
105  // i/o
106 
107  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
108  const FloatColumnVector& a);
109  friend OCTAVE_API std::istream& operator >> (std::istream& is,
110  FloatColumnVector& a);
111 
112  void resize (octave_idx_type n, const float& rfv = 0)
113  {
114  Array<float>::resize (dim_vector (n, 1), rfv);
115  }
116 
118  { Array<float>::clear (n, 1); }
119 
120 };
121 
122 // Publish externally used friend functions.
123 
124 extern OCTAVE_API FloatColumnVector real (const FloatComplexColumnVector& a);
125 extern OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a);
126 
128 
129 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray.h:128
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:281
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:230
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:207
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:128
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array.cc:1011
void clear(void)
Definition: Array.cc:87
FloatColumnVector(octave_idx_type n)
Definition: fColVector.h:42
void clear(octave_idx_type n)
Definition: fColVector.h:117
FloatColumnVector(octave_idx_type n, float val)
Definition: fColVector.h:48
FloatColumnVector(const FloatColumnVector &a)
Definition: fColVector.h:51
void resize(octave_idx_type n, const float &rfv=0)
Definition: fColVector.h:112
FloatColumnVector(const MArray< float > &a)
Definition: fColVector.h:53
FloatColumnVector(void)
Definition: fColVector.h:40
FloatColumnVector(const Array< float > &a)
Definition: fColVector.h:56
FloatColumnVector(const dim_vector &dv)
Definition: fColVector.h:45
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:87
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:95
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:601
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:585
OCTAVE_API FloatColumnVector real(const FloatComplexColumnVector &a)
Definition: fColVector.cc:137
OCTAVE_API FloatColumnVector imag(const FloatComplexColumnVector &a)
Definition: fColVector.cc:143
FloatColumnVector operator*(const FloatColumnVector &x, const float &y)
Definition: fColVector.h:127
octave_idx_type n
Definition: mx-inlines.cc:753
T * r
Definition: mx-inlines.cc:773
static T abs(T x)
Definition: pr-output.cc:1678
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
Definition: symrcm.cc:389