GNU Octave  9.1.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-2024 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
37 {
38 public:
39 
40  FloatColumnVector () : 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  ~FloatColumnVector () = default;
66 
67  OCTAVE_API bool operator == (const FloatColumnVector& a) const;
68  OCTAVE_API bool operator != (const FloatColumnVector& a) const;
69 
70  // destructive insert/delete/reorder operations
71 
73  insert (const FloatColumnVector& a, octave_idx_type r);
74 
75  OCTAVE_API FloatColumnVector& fill (float val);
77  fill (float val, octave_idx_type r1, octave_idx_type r2);
78 
79  OCTAVE_API FloatColumnVector stack (const FloatColumnVector& a) const;
80 
81  OCTAVE_API FloatRowVector transpose () const;
82 
85 
86  // resize is the destructive equivalent for this one
87 
89  extract (octave_idx_type r1, octave_idx_type r2) const;
90 
92  extract_n (octave_idx_type r1, octave_idx_type n) const;
93 
94  // matrix by column vector -> column vector operations
95 
97  operator * (const FloatMatrix& a, const FloatColumnVector& b);
98 
99  // diagonal matrix by column vector -> column vector operations
100 
102  operator * (const FloatDiagMatrix& a, const FloatColumnVector& b);
103 
104  // other operations
105 
106  OCTAVE_API float min () const;
107  OCTAVE_API float max () const;
108 
110 
111  // i/o
112 
113  friend OCTAVE_API std::ostream&
114  operator << (std::ostream& os, const FloatColumnVector& a);
115  friend OCTAVE_API std::istream&
116  operator >> (std::istream& is, FloatColumnVector& a);
117 
118  void resize (octave_idx_type n, const float& rfv = 0)
119  {
120  Array<float>::resize (dim_vector (n, 1), rfv);
121  }
122 
124  { Array<float>::clear (n, 1); }
125 
126 };
127 
128 // Publish externally used friend functions.
129 
132 
134 
135 #endif
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray.h:130
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
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:130
void clear()
Definition: Array-base.cc:109
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1023
~FloatColumnVector()=default
FloatColumnVector(octave_idx_type n)
Definition: fColVector.h:42
void clear(octave_idx_type n)
Definition: fColVector.h:123
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:118
FloatColumnVector(const MArray< float > &a)
Definition: fColVector.h:53
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:81
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:536
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:520
FloatColumnVector operator*(const FloatColumnVector &x, const float &y)
Definition: fColVector.h:133
FloatColumnVector real(const FloatComplexColumnVector &a)
Definition: fColVector.cc:137
FloatColumnVector imag(const FloatComplexColumnVector &a)
Definition: fColVector.cc:143
#define OCTAVE_API
Definition: main.cc:55
octave_idx_type n
Definition: mx-inlines.cc:761
T * r
Definition: mx-inlines.cc:781
template int8_t abs(int8_t)