GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
CRowVector.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_CRowVector_h)
27 #define octave_CRowVector_h 1
28 
29 #include "octave-config.h"
30 
31 #include "MArray.h"
32 #include "dRowVector.h"
33 #include "mx-defs.h"
34 
35 class
38 {
39  friend class ComplexColumnVector;
40 
41 public:
42 
44 
46  : MArray<Complex> (dim_vector (1, n)) { }
47 
48  explicit ComplexRowVector (const dim_vector& dv) : MArray<Complex> (dv) { }
49 
51  : MArray<Complex> (dim_vector (1, n), val) { }
52 
54 
56  : MArray<Complex> (a.as_row ()) { }
57 
59  : MArray<Complex> (a.as_row ()) { }
60 
61  explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { }
62 
64  {
66  return *this;
67  }
68 
69  ~ComplexRowVector () = default;
70 
71  OCTAVE_API bool operator == (const ComplexRowVector& a) const;
72  OCTAVE_API bool operator != (const ComplexRowVector& a) const;
73 
74  // destructive insert/delete/reorder operations
75 
77  insert (const RowVector& a, octave_idx_type c);
80 
81  OCTAVE_API ComplexRowVector& fill (double val);
84  fill (double val, octave_idx_type c1, octave_idx_type c2);
86  fill (const Complex& val, octave_idx_type c1, octave_idx_type c2);
87 
88  OCTAVE_API ComplexRowVector append (const RowVector& a) const;
89  OCTAVE_API ComplexRowVector append (const ComplexRowVector& a) const;
90 
93 
95 
96  // resize is the destructive equivalent for this one
97 
100 
103 
104  // row vector by row vector -> row vector operations
105 
108 
109  // row vector by matrix -> row vector
110 
112  operator * (const ComplexRowVector& a, const ComplexMatrix& b);
113 
115  operator * (const RowVector& a, const ComplexMatrix& b);
116 
117  // other operations
118 
119  OCTAVE_API Complex min () const;
120  OCTAVE_API Complex max () const;
121 
122  // i/o
123 
124  friend OCTAVE_API std::ostream&
125  operator << (std::ostream& os, const ComplexRowVector& a);
126  friend OCTAVE_API std::istream&
127  operator >> (std::istream& is, ComplexRowVector& a);
128 
129  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
130  {
131  Array<Complex>::resize (dim_vector (1, n), rfv);
132  }
133 
135  { Array<Complex>::clear (1, n); }
136 
137 };
138 
139 // row vector by column vector -> scalar
140 
142  const ColumnVector& b);
143 
145  const ComplexColumnVector& b);
146 
147 // other operations
148 
149 OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2,
151 
153 
154 #endif
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:217
ComplexRowVector linspace(const Complex &x1, const Complex &x2, octave_idx_type n)
Definition: CRowVector.cc:428
ComplexRowVector operator+=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:152
Complex operator*(const ComplexRowVector &a, const ColumnVector &b)
Definition: CRowVector.cc:401
ComplexRowVector operator-=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:152
#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
Array< T, Alloc > as_row() const
Return the array as a row vector.
Definition: Array.h:431
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1023
ComplexColumnVector & fill(double val)
Definition: CColVector.cc:102
ComplexColumnVector & insert(const ColumnVector &a, octave_idx_type r)
Definition: CColVector.cc:64
ComplexColumnVector extract(octave_idx_type r1, octave_idx_type r2) const
Definition: CColVector.cc:225
ComplexRowVector hermitian() const
Definition: CColVector.cc:199
ComplexRowVector transpose() const
Definition: CColVector.cc:205
ComplexColumnVector & operator=(const ComplexColumnVector &a)
Definition: CColVector.h:64
ComplexColumnVector extract_n(octave_idx_type r1, octave_idx_type n) const
Definition: CColVector.cc:240
ComplexRowVector(octave_idx_type n)
Definition: CRowVector.h:45
ComplexRowVector(const ComplexRowVector &a)
Definition: CRowVector.h:53
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
Definition: CRowVector.h:129
void clear(octave_idx_type n)
Definition: CRowVector.h:134
ComplexRowVector(const Array< Complex > &a)
Definition: CRowVector.h:58
ComplexRowVector(const RowVector &a)
Definition: CRowVector.h:61
ComplexRowVector(const dim_vector &dv)
Definition: CRowVector.h:48
ComplexRowVector(const MArray< Complex > &a)
Definition: CRowVector.h:55
ComplexRowVector(octave_idx_type n, const Complex &val)
Definition: CRowVector.h:50
~ComplexRowVector()=default
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
#define OCTAVE_API
Definition: main.cc:55
octave_idx_type n
Definition: mx-inlines.cc:761
std::complex< double > Complex
Definition: oct-cmplx.h:33