GNU Octave  6.2.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-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_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
36 OCTAVE_API
38 {
39  friend class ComplexColumnVector;
40 
41 public:
42 
43  ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { }
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  bool operator == (const ComplexRowVector& a) const;
70  bool operator != (const ComplexRowVector& a) const;
71 
72  // destructive insert/delete/reorder operations
73 
76 
77  ComplexRowVector& fill (double val);
78  ComplexRowVector& fill (const Complex& val);
80  ComplexRowVector& fill (const Complex& val,
82 
83  ComplexRowVector append (const RowVector& a) const;
84  ComplexRowVector append (const ComplexRowVector& a) const;
85 
86  ComplexColumnVector hermitian (void) const;
87  ComplexColumnVector transpose (void) const;
88 
89  friend ComplexRowVector conj (const ComplexRowVector& a);
90 
91  // resize is the destructive equivalent for this one
92 
94 
96 
97  // row vector by row vector -> row vector operations
98 
101 
102  // row vector by matrix -> row vector
103 
105  const ComplexMatrix& b);
106 
107  friend ComplexRowVector operator * (const RowVector& a,
108  const ComplexMatrix& b);
109 
110  // other operations
111 
112  Complex min (void) const;
113  Complex max (void) const;
114 
115  // i/o
116 
117  friend std::ostream& operator << (std::ostream& os,
118  const ComplexRowVector& a);
119  friend std::istream& operator >> (std::istream& is, ComplexRowVector& a);
120 
121  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
122  {
123  Array<Complex>::resize (dim_vector (1, n), rfv);
124  }
125 
127  { Array<Complex>::clear (1, n); }
128 
129 };
130 
131 // row vector by column vector -> scalar
132 
133 Complex OCTAVE_API operator * (const ComplexRowVector& a,
134  const ColumnVector& b);
135 
136 Complex OCTAVE_API operator * (const ComplexRowVector& a,
137  const ComplexColumnVector& b);
138 
139 // other operations
140 
141 OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2,
143 
145 
146 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:217
Complex OCTAVE_API operator*(const ComplexRowVector &a, const ColumnVector &b)
Definition: CRowVector.cc:401
OCTAVE_API 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:144
ComplexRowVector operator-=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:144
#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
Array< T > as_row(void) const
Return the array as a row vector.
Definition: Array.h:391
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(void) const
Definition: CColVector.cc:199
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
ComplexRowVector(void)
Definition: CRowVector.h:43
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
Definition: CRowVector.h:121
void clear(octave_idx_type n)
Definition: CRowVector.h:126
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
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_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