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_fCColVector_h) 27 #define octave_fCColVector_h 1 28 29 #include "octave-config.h" 30 31 #include "MArray.h" 32 #include "mx-defs.h" 33 34 class 35 OCTAVE_API 36 FloatComplexColumnVector : public MArray<FloatComplex> 37 { 38 friend class FloatComplexMatrix; 39 friend class FloatComplexRowVector; 40 41 public: 42 FloatComplexColumnVector(void)43 FloatComplexColumnVector (void) 44 : MArray<FloatComplex> (dim_vector (0, 1)) { } 45 FloatComplexColumnVector(octave_idx_type n)46 explicit FloatComplexColumnVector (octave_idx_type n) 47 : MArray<FloatComplex> (dim_vector (n, 1)) { } 48 FloatComplexColumnVector(const dim_vector & dv)49 explicit FloatComplexColumnVector (const dim_vector& dv) 50 : MArray<FloatComplex> (dv.as_column ()) { } 51 FloatComplexColumnVector(octave_idx_type n,const FloatComplex & val)52 FloatComplexColumnVector (octave_idx_type n, const FloatComplex& val) 53 : MArray<FloatComplex> (dim_vector (n, 1), val) { } 54 FloatComplexColumnVector(const FloatComplexColumnVector & a)55 FloatComplexColumnVector (const FloatComplexColumnVector& a) 56 : MArray<FloatComplex> (a) { } 57 FloatComplexColumnVector(const MArray<FloatComplex> & a)58 FloatComplexColumnVector (const MArray<FloatComplex>& a) 59 : MArray<FloatComplex> (a.as_column ()) { } 60 FloatComplexColumnVector(const Array<FloatComplex> & a)61 FloatComplexColumnVector (const Array<FloatComplex>& a) 62 : MArray<FloatComplex> (a.as_column ()) { } 63 64 explicit FloatComplexColumnVector (const FloatColumnVector& a); 65 66 FloatComplexColumnVector& operator = (const FloatComplexColumnVector& a) 67 { 68 MArray<FloatComplex>::operator = (a); 69 return *this; 70 } 71 72 bool operator == (const FloatComplexColumnVector& a) const; 73 bool operator != (const FloatComplexColumnVector& a) const; 74 75 // destructive insert/delete/reorder operations 76 77 FloatComplexColumnVector& insert (const FloatColumnVector& a, 78 octave_idx_type r); 79 FloatComplexColumnVector& insert (const FloatComplexColumnVector& a, 80 octave_idx_type r); 81 82 FloatComplexColumnVector& fill (float val); 83 FloatComplexColumnVector& fill (const FloatComplex& val); 84 FloatComplexColumnVector& fill (float val, 85 octave_idx_type r1, octave_idx_type r2); 86 FloatComplexColumnVector& fill (const FloatComplex& val, 87 octave_idx_type r1, octave_idx_type r2); 88 89 FloatComplexColumnVector stack (const FloatColumnVector& a) const; 90 FloatComplexColumnVector stack (const FloatComplexColumnVector& a) const; 91 92 FloatComplexRowVector hermitian (void) const; 93 FloatComplexRowVector transpose (void) const; 94 95 friend OCTAVE_API FloatComplexColumnVector 96 conj (const FloatComplexColumnVector& a); 97 98 // resize is the destructive equivalent for this one 99 100 FloatComplexColumnVector extract (octave_idx_type r1, 101 octave_idx_type r2) const; 102 103 FloatComplexColumnVector extract_n (octave_idx_type r1, 104 octave_idx_type n) const; 105 106 // column vector by column vector -> column vector operations 107 108 FloatComplexColumnVector& operator += (const FloatColumnVector& a); 109 FloatComplexColumnVector& operator -= (const FloatColumnVector& a); 110 111 // matrix by column vector -> column vector operations 112 113 friend OCTAVE_API FloatComplexColumnVector 114 operator * (const FloatComplexMatrix& a, const FloatColumnVector& b); 115 116 friend OCTAVE_API FloatComplexColumnVector 117 operator * (const FloatComplexMatrix& a, const FloatComplexColumnVector& b); 118 119 // matrix by column vector -> column vector operations 120 121 friend OCTAVE_API FloatComplexColumnVector 122 operator * (const FloatMatrix& a, const FloatComplexColumnVector& b); 123 124 // diagonal matrix by column vector -> column vector operations 125 126 friend OCTAVE_API FloatComplexColumnVector 127 operator * (const FloatDiagMatrix& a, const FloatComplexColumnVector& b); 128 129 friend OCTAVE_API FloatComplexColumnVector 130 operator * (const FloatComplexDiagMatrix& a, const ColumnVector& b); 131 132 friend OCTAVE_API FloatComplexColumnVector 133 operator * (const FloatComplexDiagMatrix& a, const FloatComplexColumnVector& b); 134 135 // other operations 136 137 FloatComplex min (void) const; 138 FloatComplex max (void) const; 139 140 FloatColumnVector abs (void) const; 141 142 // i/o 143 144 friend OCTAVE_API std::ostream& 145 operator << (std::ostream& os, const FloatComplexColumnVector& a); 146 friend OCTAVE_API std::istream& operator >> (std::istream& is, 147 FloatComplexColumnVector& a); 148 149 void resize (octave_idx_type n, const FloatComplex& rfv = FloatComplex (0)) 150 { 151 Array<FloatComplex>::resize (dim_vector (n, 1), rfv); 152 } 153 clear(octave_idx_type n)154 void clear (octave_idx_type n) 155 { Array<FloatComplex>::clear (n, 1); } 156 157 }; 158 159 MARRAY_FORWARD_DEFS (MArray, FloatComplexColumnVector, FloatComplex) 160 161 #endif 162