GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CRowVector.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2015 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_CRowVector_h)
24 #define octave_CRowVector_h 1
25 
26 #include "MArray.h"
27 #include "dRowVector.h"
28 
29 #include "mx-defs.h"
30 
31 class
32 OCTAVE_API
34 {
35  friend class ComplexColumnVector;
36 
37 public:
38 
39  ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { }
40 
42  : MArray<Complex> (dim_vector (1, n)) { }
43 
44  explicit ComplexRowVector (const dim_vector& dv) : MArray<Complex> (dv) { }
45 
47  : MArray<Complex> (dim_vector (1, n), val) { }
48 
50 
52  : MArray<Complex> (a.as_row ()) { }
53 
55  : MArray<Complex> (a.as_row ()) { }
56 
57  explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { }
58 
60  {
62  return *this;
63  }
64 
65  bool operator == (const ComplexRowVector& a) const;
66  bool operator != (const ComplexRowVector& a) const;
67 
68  // destructive insert/delete/reorder operations
69 
72 
73  ComplexRowVector& fill (double val);
74  ComplexRowVector& fill (const Complex& val);
76  ComplexRowVector& fill (const Complex& val,
78 
79  ComplexRowVector append (const RowVector& a) const;
80  ComplexRowVector append (const ComplexRowVector& a) const;
81 
82  ComplexColumnVector hermitian (void) const;
83  ComplexColumnVector transpose (void) const;
84 
85  friend ComplexRowVector conj (const ComplexRowVector& a);
86 
87  // resize is the destructive equivalent for this one
88 
90 
92 
93  // row vector by row vector -> row vector operations
94 
97 
98  // row vector by matrix -> row vector
99 
101  const ComplexMatrix& b);
102 
103  friend ComplexRowVector operator * (const RowVector& a,
104  const ComplexMatrix& b);
105 
106  // other operations
107 
108  Complex min (void) const;
109  Complex max (void) const;
110 
111  // i/o
112 
113  friend std::ostream& operator << (std::ostream& os,
114  const ComplexRowVector& a);
115  friend std::istream& operator >> (std::istream& is, ComplexRowVector& a);
116 
117  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
118  {
119  Array<Complex>::resize (dim_vector (1, n), rfv);
120  }
121 
123  { Array<Complex>::clear (1, n); }
124 
125 };
126 
127 // row vector by column vector -> scalar
128 
129 Complex OCTAVE_API operator * (const ComplexRowVector& a,
130  const ColumnVector& b);
131 
132 Complex OCTAVE_API operator * (const ComplexRowVector& a,
133  const ComplexColumnVector& b);
134 
135 // other operations
136 
137 OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2,
138  octave_idx_type n);
139 
141 
142 #endif
ComplexRowVector(const MArray< Complex > &a)
Definition: CRowVector.h:51
ComplexColumnVector & insert(const ColumnVector &a, octave_idx_type r)
Definition: CColVector.cc:78
void clear(octave_idx_type n)
Definition: CRowVector.h:122
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
ComplexRowVector(const dim_vector &dv)
Definition: CRowVector.h:44
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:382
ComplexRowVector(octave_idx_type n)
Definition: CRowVector.h:41
ComplexRowVector(const Array< Complex > &a)
Definition: CRowVector.h:54
Array< Complex > as_row(void) const
Return the array as a row vector.
Definition: Array.h:289
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:244
ComplexRowVector(octave_idx_type n, const Complex &val)
Definition: CRowVector.h:46
ComplexColumnVector extract_n(octave_idx_type r1, octave_idx_type n) const
Definition: CColVector.cc:267
ComplexRowVector(void)
Definition: CRowVector.h:39
ComplexColumnVector extract(octave_idx_type r1, octave_idx_type r2) const
Definition: CColVector.cc:252
ComplexRowVector operator-=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:140
Complex OCTAVE_API operator*(const ComplexRowVector &a, const ColumnVector &b)
Definition: CRowVector.cc:437
ComplexRowVector(const ComplexRowVector &a)
Definition: CRowVector.h:49
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray-decl.h:236
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
Definition: CRowVector.h:117
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
ComplexRowVector hermitian(void) const
Definition: CColVector.cc:226
ComplexRowVector(const RowVector &a)
Definition: CRowVector.h:57
ComplexColumnVector & fill(double val)
Definition: CColVector.cc:122
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:233
void clear(void)
Definition: Array.cc:84
OCTAVE_API ComplexRowVector linspace(const Complex &x1, const Complex &x2, octave_idx_type n)
Definition: CRowVector.cc:463
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
std::complex< double > Complex
Definition: oct-cmplx.h:29
ComplexColumnVector & operator=(const ComplexColumnVector &a)
Definition: CColVector.h:61
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:65
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:210
ComplexRowVector operator+=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:140