GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dColVector.h
Go to the documentation of this file.
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_dColVector_h)
27 #define octave_dColVector_h 1
28 
29 #include "octave-config.h"
30 
31 #include "MArray.h"
32 #include "mx-defs.h"
33 
34 class
35 OCTAVE_API
37 {
38 public:
39 
40  ColumnVector (void) : MArray<double> (dim_vector (0, 1)) { }
41 
43  : MArray<double> (dim_vector (n, 1)) { }
44 
45  explicit ColumnVector (const dim_vector& dv)
46  : MArray<double> (dv.as_column ()) { }
47 
49  : MArray<double> (dim_vector (n, 1), val) { }
50 
51  ColumnVector (const ColumnVector& a) : MArray<double> (a) { }
52 
53  ColumnVector (const MArray<double>& a) : MArray<double> (a.as_column ()) { }
54  ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { }
55 
56  ColumnVector& operator = (const ColumnVector& a)
57  {
59  return *this;
60  }
61 
62  bool operator == (const ColumnVector& a) const;
63  bool operator != (const ColumnVector& a) const;
64 
65  // destructive insert/delete/reorder operations
66 
67  ColumnVector& insert (const ColumnVector& a, octave_idx_type r);
68 
69  ColumnVector& fill (double val);
70  ColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2);
71 
72  ColumnVector stack (const ColumnVector& a) const;
73 
74  RowVector transpose (void) const;
75 
76  friend OCTAVE_API ColumnVector real (const ComplexColumnVector& a);
77  friend OCTAVE_API ColumnVector imag (const ComplexColumnVector& a);
78 
79  // resize is the destructive equivalent for this one
80 
81  ColumnVector extract (octave_idx_type r1, octave_idx_type r2) const;
82 
83  ColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const;
84 
85  // matrix by column vector -> column vector operations
86 
87  friend OCTAVE_API ColumnVector operator * (const Matrix& a,
88  const ColumnVector& b);
89 
90  // diagonal matrix by column vector -> column vector operations
91 
92  friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a,
93  const ColumnVector& b);
94 
95  // other operations
96 
97  double min (void) const;
98  double max (void) const;
99 
100  ColumnVector abs (void) const;
101 
102  // i/o
103 
104  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
105  const ColumnVector& a);
106  friend OCTAVE_API std::istream& operator >> (std::istream& is,
107  ColumnVector& a);
108 
109  void resize (octave_idx_type n, const double& rfv = 0)
110  {
111  Array<double>::resize (dim_vector (n, 1), rfv);
112  }
113 
115  { Array<double>::clear (n, 1); }
116 
117 };
118 
119 // Publish externally used friend functions.
120 
121 extern OCTAVE_API ColumnVector real (const ComplexColumnVector& a);
122 extern OCTAVE_API ColumnVector imag (const ComplexColumnVector& a);
123 
125 
126 #endif
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray.h:128
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:281
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:230
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:207
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array.cc:1011
void clear(void)
Definition: Array.cc:87
void resize(octave_idx_type n, const double &rfv=0)
Definition: dColVector.h:109
ColumnVector(const dim_vector &dv)
Definition: dColVector.h:45
ColumnVector(octave_idx_type n)
Definition: dColVector.h:42
ColumnVector(octave_idx_type n, double val)
Definition: dColVector.h:48
ColumnVector(const MArray< double > &a)
Definition: dColVector.h:53
void clear(octave_idx_type n)
Definition: dColVector.h:114
ColumnVector(const ColumnVector &a)
Definition: dColVector.h:51
ColumnVector(const Array< double > &a)
Definition: dColVector.h:54
ColumnVector(void)
Definition: dColVector.h:40
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:87
Definition: dMatrix.h:42
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:95
OCTAVE_API ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:143
OCTAVE_API ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:137
ColumnVector operator*(const ColumnVector &x, const double &y)
Definition: dColVector.h:124
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:601
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:585
octave_idx_type n
Definition: mx-inlines.cc:753
T * r
Definition: mx-inlines.cc:773
static T abs(T x)
Definition: pr-output.cc:1678
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:389