GNU Octave  4.4.1
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-2018 John W. Eaton
4 Copyright (C) 2010 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software: you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_CColVector_h)
25 #define octave_CColVector_h 1
26 
27 #include "octave-config.h"
28 
29 #include "MArray.h"
30 #include "mx-defs.h"
31 
32 class
33 OCTAVE_API
35 {
36  friend class ComplexMatrix;
37  friend class ComplexRowVector;
38 
39 public:
40 
42 
44  : MArray<Complex> (dim_vector (n, 1)) { }
45 
46  explicit ComplexColumnVector (const dim_vector& dv)
47  : MArray<Complex> (dv.as_column ()) { }
48 
50  : MArray<Complex> (dim_vector (n, 1), val) { }
51 
53 
55  : MArray<Complex> (a.as_column ()) { }
56 
58  : MArray<Complex> (a.as_column ()) { }
59 
60  explicit ComplexColumnVector (const ColumnVector& a);
61 
63  {
65  return *this;
66  }
67 
68  bool operator == (const ComplexColumnVector& a) const;
69  bool operator != (const ComplexColumnVector& a) const;
70 
71  // destructive insert/delete/reorder operations
72 
75 
76  ComplexColumnVector& fill (double val);
78  ComplexColumnVector& fill (double val,
82 
83  ComplexColumnVector stack (const ColumnVector& a) const;
84  ComplexColumnVector stack (const ComplexColumnVector& a) const;
85 
86  ComplexRowVector hermitian (void) const;
87  ComplexRowVector transpose (void) const;
88 
89  friend OCTAVE_API ComplexColumnVector conj (const ComplexColumnVector& a);
90 
91  // resize is the destructive equivalent for this one
92 
94 
96 
97  // column vector by column vector -> column vector operations
98 
101 
102  // matrix by column vector -> column vector operations
103 
104  friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a,
105  const ColumnVector& b);
106 
107  friend OCTAVE_API ComplexColumnVector operator * (const ComplexMatrix& a,
108  const ComplexColumnVector& b);
109 
110  // matrix by column vector -> column vector operations
111 
112  friend OCTAVE_API ComplexColumnVector operator * (const Matrix& a,
113  const ComplexColumnVector& b);
114 
115  // diagonal matrix by column vector -> column vector operations
116 
117  friend OCTAVE_API ComplexColumnVector operator * (const DiagMatrix& a,
118  const ComplexColumnVector& b);
119 
120  friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix& a,
121  const ColumnVector& b);
122 
123  friend OCTAVE_API ComplexColumnVector operator * (const ComplexDiagMatrix& a,
124  const ComplexColumnVector& b);
125 
126  // other operations
127 
128  Complex min (void) const;
129  Complex max (void) const;
130 
131  ColumnVector abs (void) const;
132 
133  // i/o
134 
135  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
136  const ComplexColumnVector& a);
137  friend OCTAVE_API std::istream& operator >> (std::istream& is,
139 
140  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
141  {
142  Array<Complex>::resize (dim_vector (n, 1), rfv);
143  }
144 
146  { Array<Complex>::clear (n, 1); }
147 
148 };
149 
151 
152 #endif
ComplexRowVector & fill(double val)
Definition: CRowVector.cc:95
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
Definition: CColVector.h:140
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:566
ComplexColumnVector(const Array< Complex > &a)
Definition: CColVector.h:57
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
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:386
static T abs(T x)
Definition: pr-output.cc:1696
ComplexColumnVector(octave_idx_type n, const Complex &val)
Definition: CColVector.h:49
ComplexRowVector extract(octave_idx_type c1, octave_idx_type c2) const
Definition: CRowVector.cc:212
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray.h:126
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
ComplexColumnVector(const ComplexColumnVector &a)
Definition: CColVector.h:52
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:215
Array< Complex > as_column(void) const
Return the array as a column vector.
Definition: Array.h:370
ComplexRowVector & operator=(const ComplexRowVector &a)
Definition: CRowVector.h:60
friend class ComplexColumnVector
Definition: CRowVector.h:36
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
Definition: Array.cc:1010
ComplexColumnVector operator*(const ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:150
ComplexColumnVector operator-=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:150
void clear(octave_idx_type n)
Definition: CColVector.h:145
Definition: dMatrix.h:36
ComplexRowVector extract_n(octave_idx_type c1, octave_idx_type n) const
Definition: CRowVector.cc:227
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:550
ComplexColumnVector hermitian(void) const
Definition: CRowVector.cc:192
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:85
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
void clear(void)
Definition: Array.cc:86
ComplexColumnVector(const dim_vector &dv)
Definition: CColVector.h:46
ComplexColumnVector operator+=(ComplexColumnVector &x, const Complex &y)
Definition: CColVector.h:150
ComplexColumnVector(void)
Definition: CColVector.h:41
ComplexRowVector & insert(const RowVector &a, octave_idx_type c)
Definition: CRowVector.cc:57
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
b
Definition: cellfun.cc:400
std::complex< double > Complex
Definition: oct-cmplx.h:31
ComplexColumnVector(octave_idx_type n)
Definition: CColVector.h:43
write the output to stdout if nargout is
Definition: load-save.cc:1612
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
dim_vector dv
Definition: sub2ind.cc:263
octave::stream os
Definition: file-io.cc:627
ComplexColumnVector(const MArray< Complex > &a)
Definition: CColVector.h:54
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:204