GNU Octave  8.1.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-2023 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
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  OCTAVE_API bool operator == (const ComplexRowVector& a) const;
70  OCTAVE_API bool operator != (const ComplexRowVector& a) const;
71 
72  // destructive insert/delete/reorder operations
73 
75  insert (const RowVector& a, octave_idx_type c);
78 
79  OCTAVE_API ComplexRowVector& fill (double val);
82  fill (double val, octave_idx_type c1, octave_idx_type c2);
84  fill (const Complex& val, octave_idx_type c1, octave_idx_type c2);
85 
86  OCTAVE_API ComplexRowVector append (const RowVector& a) const;
87  OCTAVE_API ComplexRowVector append (const ComplexRowVector& a) const;
88 
91 
93 
94  // resize is the destructive equivalent for this one
95 
98 
101 
102  // row vector by row vector -> row vector operations
103 
106 
107  // row vector by matrix -> row vector
108 
110  operator * (const ComplexRowVector& a, const ComplexMatrix& b);
111 
113  operator * (const RowVector& a, const ComplexMatrix& b);
114 
115  // other operations
116 
117  OCTAVE_API Complex min (void) const;
118  OCTAVE_API Complex max (void) const;
119 
120  // i/o
121 
122  friend OCTAVE_API std::ostream&
123  operator << (std::ostream& os, const ComplexRowVector& a);
124  friend OCTAVE_API std::istream&
125  operator >> (std::istream& is, ComplexRowVector& a);
126 
127  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
128  {
129  Array<Complex>::resize (dim_vector (1, n), rfv);
130  }
131 
133  { Array<Complex>::clear (1, n); }
134 
135 };
136 
137 // row vector by column vector -> scalar
138 
140  const ColumnVector& b);
141 
143  const ComplexColumnVector& b);
144 
145 // other operations
146 
147 OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2,
149 
151 
152 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:217
OCTAVE_API ComplexRowVector linspace(const Complex &x1, const Complex &x2, octave_idx_type n)
Definition: CRowVector.cc:428
OCTAVE_API Complex operator*(const ComplexRowVector &a, const ColumnVector &b)
Definition: CRowVector.cc:401
ComplexRowVector operator+=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:150
ComplexRowVector operator-=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:150
#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
OCTARRAY_API void clear(void)
Definition: Array-base.cc:109
OCTARRAY_OVERRIDABLE_FUNC_API Array< T, Alloc > as_row(void) const
Return the array as a row vector.
Definition: Array.h:431
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1032
OCTAVE_API ComplexColumnVector & fill(double val)
Definition: CColVector.cc:102
OCTAVE_API ComplexColumnVector & insert(const ColumnVector &a, octave_idx_type r)
Definition: CColVector.cc:64
OCTAVE_API ComplexColumnVector extract(octave_idx_type r1, octave_idx_type r2) const
Definition: CColVector.cc:225
OCTAVE_API ComplexRowVector hermitian(void) const
Definition: CColVector.cc:199
ComplexColumnVector & operator=(const ComplexColumnVector &a)
Definition: CColVector.h:64
OCTAVE_API 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:127
void clear(octave_idx_type n)
Definition: CRowVector.h:132
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:81
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.in.cc:55
class OCTAVE_API ComplexRowVector
Definition: mx-fwd.h:51
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:391