GNU Octave  9.1.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-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_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
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 OCTAVE_API ComplexColumnVector (const ColumnVector& a);
63 
65  {
67  return *this;
68  }
69 
70  ~ComplexColumnVector () = default;
71 
72  OCTAVE_API bool operator == (const ComplexColumnVector& a) const;
73  OCTAVE_API bool operator != (const ComplexColumnVector& a) const;
74 
75  // destructive insert/delete/reorder operations
76 
81 
82  OCTAVE_API ComplexColumnVector& fill (double val);
85  fill (double val, octave_idx_type r1, octave_idx_type r2);
87  fill (const Complex& val, octave_idx_type r1, octave_idx_type r2);
88 
89  OCTAVE_API ComplexColumnVector stack (const ColumnVector& a) const;
90  OCTAVE_API ComplexColumnVector stack (const ComplexColumnVector& a) const;
91 
94 
96 
97  // resize is the destructive equivalent for this one
98 
100  extract (octave_idx_type r1, octave_idx_type r2) const;
101 
104 
105  // column vector by column vector -> column vector operations
106 
109 
110  // matrix by column vector -> column vector operations
111 
113  const ColumnVector& b);
114 
116  const ComplexColumnVector& b);
117 
118  // matrix by column vector -> column vector operations
119 
121  const ComplexColumnVector& b);
122 
123  // diagonal matrix by column vector -> column vector operations
124 
126  const ComplexColumnVector& b);
127 
129  const ColumnVector& b);
130 
132  const ComplexColumnVector& b);
133 
134  // other operations
135 
136  OCTAVE_API Complex min () const;
137  OCTAVE_API Complex max () const;
138 
139  OCTAVE_API ColumnVector abs () const;
140 
141  // i/o
142 
143  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
144  const ComplexColumnVector& a);
145  friend OCTAVE_API std::istream& operator >> (std::istream& is,
147 
148  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
149  {
150  Array<Complex>::resize (dim_vector (n, 1), rfv);
151  }
152 
154  { Array<Complex>::clear (n, 1); }
155 
156 };
157 
159 
160 #endif
template 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:158
ComplexColumnVector operator*(const ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:158
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:158
#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_column() const
Return the array as a column vector.
Definition: Array.h:420
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1023
ComplexColumnVector(octave_idx_type n)
Definition: CColVector.h:45
~ComplexColumnVector()=default
ComplexColumnVector(const ComplexColumnVector &a)
Definition: CColVector.h:54
void clear(octave_idx_type n)
Definition: CColVector.h:153
ComplexColumnVector(octave_idx_type n, const Complex &val)
Definition: CColVector.h:51
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:148
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
ComplexColumnVector hermitian() const
Definition: CRowVector.cc:196
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
ComplexRowVector & insert(const RowVector &a, octave_idx_type c)
Definition: CRowVector.cc:61
ComplexColumnVector transpose() const
Definition: CRowVector.cc:202
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:81
Definition: dMatrix.h:42
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
T * r
Definition: mx-inlines.cc:781
std::complex< double > Complex
Definition: oct-cmplx.h:33
template int8_t abs(int8_t)