GNU Octave  4.4.1
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-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if ! defined (octave_CRowVector_h)
24 #define octave_CRowVector_h 1
25 
26 #include "octave-config.h"
27 
28 #include "MArray.h"
29 #include "dRowVector.h"
30 #include "mx-defs.h"
31 
32 class
33 OCTAVE_API
35 {
36  friend class ComplexColumnVector;
37 
38 public:
39 
40  ComplexRowVector (void) : MArray<Complex> (dim_vector (1, 0)) { }
41 
43  : MArray<Complex> (dim_vector (1, n)) { }
44 
45  explicit ComplexRowVector (const dim_vector& dv) : MArray<Complex> (dv) { }
46 
48  : MArray<Complex> (dim_vector (1, n), val) { }
49 
51 
53  : MArray<Complex> (a.as_row ()) { }
54 
56  : MArray<Complex> (a.as_row ()) { }
57 
58  explicit ComplexRowVector (const RowVector& a) : MArray<Complex> (a) { }
59 
61  {
63  return *this;
64  }
65 
66  bool operator == (const ComplexRowVector& a) const;
67  bool operator != (const ComplexRowVector& a) const;
68 
69  // destructive insert/delete/reorder operations
70 
73 
74  ComplexRowVector& fill (double val);
75  ComplexRowVector& fill (const Complex& val);
79 
80  ComplexRowVector append (const RowVector& a) const;
82 
83  ComplexColumnVector hermitian (void) const;
84  ComplexColumnVector transpose (void) const;
85 
86  friend ComplexRowVector conj (const ComplexRowVector& a);
87 
88  // resize is the destructive equivalent for this one
89 
91 
93 
94  // row vector by row vector -> row vector operations
95 
98 
99  // row vector by matrix -> row vector
100 
102  const ComplexMatrix& b);
103 
104  friend ComplexRowVector operator * (const RowVector& a,
105  const ComplexMatrix& b);
106 
107  // other operations
108 
109  Complex min (void) const;
110  Complex max (void) const;
111 
112  // i/o
113 
114  friend std::ostream& operator << (std::ostream& os,
115  const ComplexRowVector& a);
116  friend std::istream& operator >> (std::istream& is, ComplexRowVector& a);
117 
118  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
119  {
120  Array<Complex>::resize (dim_vector (1, n), rfv);
121  }
122 
124  { Array<Complex>::clear (1, n); }
125 
126 };
127 
128 // row vector by column vector -> scalar
129 
130 Complex OCTAVE_API operator * (const ComplexRowVector& a,
131  const ColumnVector& b);
132 
133 Complex OCTAVE_API operator * (const ComplexRowVector& a,
134  const ComplexColumnVector& b);
135 
136 // other operations
137 
138 OCTAVE_API ComplexRowVector linspace (const Complex& x1, const Complex& x2,
139  octave_idx_type n);
140 
142 
143 #endif
ComplexRowVector(const MArray< Complex > &a)
Definition: CRowVector.h:52
ComplexColumnVector & insert(const ColumnVector &a, octave_idx_type r)
Definition: CColVector.cc:62
void clear(octave_idx_type n)
Definition: CRowVector.h:123
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:566
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
ComplexRowVector(const dim_vector &dv)
Definition: CRowVector.h:45
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
ComplexRowVector hermitian(void) const
Definition: CColVector.cc:197
ComplexRowVector(octave_idx_type n)
Definition: CRowVector.h:42
ComplexRowVector(const Array< Complex > &a)
Definition: CRowVector.h:55
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
ComplexColumnVector extract_n(octave_idx_type r1, octave_idx_type n) const
Definition: CColVector.cc:238
#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 conj(const ComplexColumnVector &a)
Definition: CColVector.cc:215
ComplexRowVector(octave_idx_type n, const Complex &val)
Definition: CRowVector.h:47
ComplexRowVector(void)
Definition: CRowVector.h:40
ComplexRowVector operator-=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:141
Complex OCTAVE_API operator*(const ComplexRowVector &a, const ColumnVector &b)
Definition: CRowVector.cc:397
ComplexRowVector(const ComplexRowVector &a)
Definition: CRowVector.h:50
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
Definition: Array.cc:1010
bool append
Definition: load-save.cc:1618
void resize(octave_idx_type n, const Complex &rfv=Complex(0))
Definition: CRowVector.h:118
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:550
ComplexRowVector(const RowVector &a)
Definition: CRowVector.h:58
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:85
Array< Complex > as_row(void) const
Return the array as a row vector.
Definition: Array.h:380
ComplexColumnVector & fill(double val)
Definition: CColVector.cc:100
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
void clear(void)
Definition: Array.cc:86
OCTAVE_API ComplexRowVector linspace(const Complex &x1, const Complex &x2, octave_idx_type n)
Definition: CRowVector.cc:424
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 extract(octave_idx_type r1, octave_idx_type r2) const
Definition: CColVector.cc:223
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
ComplexColumnVector & operator=(const ComplexColumnVector &a)
Definition: CColVector.h:62
octave::stream os
Definition: file-io.cc:627
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:204
ComplexRowVector operator+=(ComplexRowVector &x, const Complex &y)
Definition: CRowVector.h:141