GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
CColVector.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_CColVector_h)
27 #define octave_CColVector_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  friend class ComplexMatrix;
39  friend class ComplexRowVector;
40 
41 public:
42 
44 
46  : MArray<Complex> (dim_vector (n, 1)) { }
47 
48  explicit ComplexColumnVector (const dim_vector& dv)
49  : MArray<Complex> (dv.as_column ()) { }
50 
52  : MArray<Complex> (dim_vector (n, 1), val) { }
53 
55 
57  : MArray<Complex> (a.as_column ()) { }
58 
60  : MArray<Complex> (a.as_column ()) { }
61 
62  explicit ComplexColumnVector (const ColumnVector& a);
63 
65  {
67  return *this;
68  }
69 
70  bool operator == (const ComplexColumnVector& a) const;
71  bool operator != (const ComplexColumnVector& a) const;
72 
73  // destructive insert/delete/reorder operations
74 
77 
78  ComplexColumnVector& fill (double val);
79  ComplexColumnVector& fill (const Complex& val);
80  ComplexColumnVector& fill (double val,
82  ComplexColumnVector& fill (const Complex& val,
84 
85  ComplexColumnVector stack (const ColumnVector& a) const;
86  ComplexColumnVector stack (const ComplexColumnVector& a) const;
87 
88  ComplexRowVector hermitian (void) const;
89  ComplexRowVector transpose (void) const;
90 
91  friend OCTAVE_API ComplexColumnVector conj (const ComplexColumnVector& a);
92 
93  // resize is the destructive equivalent for this one
94 
96 
98 
99  // column vector by column vector -> column vector operations
100 
103 
104  // matrix by column vector -> column vector operations
105 
106  friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a,
107  const ColumnVector& b);
108 
109  friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a,
110  const ComplexColumnVector& b);
111 
112  // matrix by column vector -> column vector operations
113 
114  friend OCTAVE_API ComplexColumnVector operator * (const Matrix& a,
115  const ComplexColumnVector& b);
116 
117  // diagonal matrix by column vector -> column vector operations
118 
119  friend OCTAVE_API ComplexColumnVector operator * (const DiagMatrix& a,
120  const ComplexColumnVector& b);
121 
122  friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix& a,
123  const ColumnVector& b);
124 
125  friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix& a,
126  const ComplexColumnVector& b);
127 
128  // other operations
129 
130  Complex min (void) const;
131  Complex max (void) const;
132 
133  ColumnVector abs (void) const;
134 
135  // i/o
136 
137  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
138  const ComplexColumnVector& a);
139  friend OCTAVE_API std::istream& operator >> (std::istream& is,
141 
142  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
143  {
144  Array<Complex>::resize (dim_vector (n, 1), rfv);
145  }
146 
148  { Array<Complex>::clear (n, 1); }
149 
150 };
151 
153 
154 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:217
ComplexColumnVector operator+=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:152
ComplexColumnVector operator*(const ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:152
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:152
#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
Array< T > as_column(void) const
Return the array as a column vector.
Definition: Array.h:381
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
ComplexColumnVector(octave_idx_type n)
Definition: CColVector.h:45
ComplexColumnVector(const ComplexColumnVector &a)
Definition: CColVector.h:54
void clear(octave_idx_type n)
Definition: CColVector.h:147
ComplexColumnVector(octave_idx_type n, const Complex &val)
Definition: CColVector.h:51
ComplexColumnVector(void)
Definition: CColVector.h:43
ComplexColumnVector(const dim_vector &dv)
Definition: CColVector.h:48
ComplexColumnVector(const Array< Complex > &a)
Definition: CColVector.h:59
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
Definition: CColVector.h:142
ComplexColumnVector(const MArray< Complex > &a)
Definition: CColVector.h:56
ComplexRowVector extract(octave_idx_type c1, octave_idx_type c2) const
Definition: CRowVector.cc:216
friend class ComplexColumnVector
Definition: CRowVector.h:39
ComplexRowVector & operator=(const ComplexRowVector &a)
Definition: CRowVector.h:63
ComplexRowVector extract_n(octave_idx_type c1, octave_idx_type n) const
Definition: CRowVector.cc:231
ComplexRowVector & fill(double val)
Definition: CRowVector.cc:99
ComplexColumnVector hermitian(void) const
Definition: CRowVector.cc:196
ComplexRowVector & insert(const RowVector &a, octave_idx_type c)
Definition: CRowVector.cc:61
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:87
Definition: dMatrix.h:42
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
T * r
Definition: mx-inlines.cc:773
std::complex< double > Complex
Definition: oct-cmplx.h:33
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