GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
dColVector.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1994-2025 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
34class OCTAVE_API ColumnVector : public MArray<double>
35{
36public:
37
39
41 : MArray<double> (dim_vector (n, 1)) { }
42
43 explicit ColumnVector (const dim_vector& dv)
44 : MArray<double> (dv.as_column ()) { }
45
47 : MArray<double> (dim_vector (n, 1), val) { }
48
49 ColumnVector (const ColumnVector& a) : MArray<double> (a) { }
50
51 ColumnVector (const MArray<double>& a) : MArray<double> (a.as_column ()) { }
52 ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { }
53
55 {
57 return *this;
58 }
59
60 ~ColumnVector () = default;
61
62 OCTAVE_API bool operator == (const ColumnVector& a) const;
63 OCTAVE_API bool operator != (const ColumnVector& a) const;
64
65 // destructive insert/delete/reorder operations
66
68
69 OCTAVE_API ColumnVector& fill (double val);
71 fill (double val, octave_idx_type r1, octave_idx_type r2);
72
73 OCTAVE_API ColumnVector stack (const ColumnVector& a) const;
74
76
79
80 // resize is the destructive equivalent for this one
81
83 extract (octave_idx_type r1, octave_idx_type r2) const;
84
86 extract_n (octave_idx_type r1, octave_idx_type n) const;
87
88 // matrix by column vector -> column vector operations
89
91 const ColumnVector& b);
92
93 // diagonal matrix by column vector -> column vector operations
94
96 const ColumnVector& b);
97
98 // other operations
99
100 OCTAVE_API double min () const;
101 OCTAVE_API double max () const;
102
103 OCTAVE_API ColumnVector abs () const;
104
105 // i/o
106
107 friend OCTAVE_API std::ostream& operator << (std::ostream& os,
108 const ColumnVector& a);
109 friend OCTAVE_API std::istream& operator >> (std::istream& is,
110 ColumnVector& a);
111
112 void resize (octave_idx_type n, const double& rfv = 0)
113 {
114 Array<double>::resize (dim_vector (n, 1), rfv);
115 }
116
119
120};
121
122// Publish externally used friend functions.
123
126
128
129#endif
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition MArray.h:128
MArray< T > operator*(const MArray< T > &, const T &)
Definition MArray.cc:329
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
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
void clear()
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Array< T, Alloc > & insert(const Array< T, Alloc > &a, const Array< octave_idx_type > &idx)
Insert an array into another at a specified position.
void fill(const T &val)
Definition Array-base.cc:96
void resize(octave_idx_type n, const double &rfv=0)
Definition dColVector.h:112
ColumnVector(const dim_vector &dv)
Definition dColVector.h:43
ColumnVector(octave_idx_type n)
Definition dColVector.h:40
ColumnVector(octave_idx_type n, double val)
Definition dColVector.h:46
ColumnVector(const MArray< double > &a)
Definition dColVector.h:51
void clear(octave_idx_type n)
Definition dColVector.h:117
~ColumnVector()=default
ColumnVector(const ColumnVector &a)
Definition dColVector.h:49
ColumnVector(const Array< double > &a)
Definition dColVector.h:52
Template for N-dimensional array classes with like-type math operators.
Definition MArray.h:61
MArray< T > transpose() const
Definition MArray.h:97
MArray< T > & operator=(const MArray< T > &a)
Definition MArray.h:79
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:90
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition dim-vector.h:532
bool operator==(const dim_vector &a, const dim_vector &b)
Definition dim-vector.h:516
#define OCTAVE_API
Definition main.in.cc:55
template int8_t abs(int8_t)