GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
fRowVector.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_fRowVector_h)
27 #define octave_fRowVector_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  FloatRowVector (void) : MArray<float> (dim_vector (1, 0)) { }
41 
43  : MArray<float> (dim_vector (1, n)) { }
44 
45  explicit FloatRowVector (const dim_vector& dv)
46  : MArray<float> (dv.as_row ()) { }
47 
49  : MArray<float> (dim_vector (1, n), val) { }
50 
51  FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { }
52 
53  FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { }
54 
55  FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { }
56 
57  FloatRowVector& operator = (const FloatRowVector& a)
58  {
60  return *this;
61  }
62 
63  bool operator == (const FloatRowVector& a) const;
64  bool operator != (const FloatRowVector& a) const;
65 
66  // destructive insert/delete/reorder operations
67 
68  FloatRowVector& insert (const FloatRowVector& a, octave_idx_type c);
69 
70  FloatRowVector& fill (float val);
71  FloatRowVector& fill (float val, octave_idx_type c1, octave_idx_type c2);
72 
73  FloatRowVector append (const FloatRowVector& a) const;
74 
75  FloatColumnVector transpose (void) const;
76 
77  friend OCTAVE_API FloatRowVector real (const FloatComplexRowVector& a);
78  friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a);
79 
80  // resize is the destructive equivalent for this one
81 
82  FloatRowVector extract (octave_idx_type c1, octave_idx_type c2) const;
83 
84  FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
85 
86  // row vector by matrix -> row vector
87 
88  friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a,
89  const FloatMatrix& b);
90 
91  // other operations
92 
93  float min (void) const;
94  float max (void) const;
95 
96  // i/o
97 
98  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
99  const FloatRowVector& a);
100  friend OCTAVE_API std::istream& operator >> (std::istream& is,
101  FloatRowVector& a);
102 
103  void resize (octave_idx_type n, const float& rfv = 0)
104  {
105  Array<float>::resize (dim_vector (1, n), rfv);
106  }
107 
109  { Array<float>::clear (1, n); }
110 
111 };
112 
113 // row vector by column vector -> scalar
114 
115 float OCTAVE_API operator * (const FloatRowVector& a,
116  const FloatColumnVector& b);
117 
118 Complex OCTAVE_API operator * (const FloatRowVector& a,
119  const ComplexColumnVector& b);
120 
121 // other operations
122 
123 OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n);
124 
126 
127 #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
FloatRowVector(const dim_vector &dv)
Definition: fRowVector.h:45
FloatRowVector(const Array< float > &a)
Definition: fRowVector.h:55
FloatRowVector(octave_idx_type n)
Definition: fRowVector.h:42
void clear(octave_idx_type n)
Definition: fRowVector.h:108
FloatRowVector(void)
Definition: fRowVector.h:40
FloatRowVector(const FloatRowVector &a)
Definition: fRowVector.h:51
FloatRowVector(octave_idx_type n, float val)
Definition: fRowVector.h:48
void resize(octave_idx_type n, const float &rfv=0)
Definition: fRowVector.h:103
FloatRowVector(const MArray< float > &a)
Definition: fRowVector.h:53
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:87
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:95
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:137
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:143
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 FloatRowVector linspace(float x1, float x2, octave_idx_type n)
Definition: fRowVector.cc:271
float OCTAVE_API operator*(const FloatRowVector &a, const FloatColumnVector &b)
Definition: fRowVector.cc:311
octave_idx_type n
Definition: mx-inlines.cc:753
std::complex< double > Complex
Definition: oct-cmplx.h:33
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