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
dColVector.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2015 John W. Eaton
4 Copyright (C) 2010 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if !defined (octave_dColVector_h)
25 #define octave_dColVector_h 1
26 
27 #include "MArray.h"
28 
29 #include "mx-defs.h"
30 
31 class
32 OCTAVE_API
34 {
35 public:
36 
37  ColumnVector (void) : MArray<double> (dim_vector (0, 1)) { }
38 
40  : MArray<double> (dim_vector (n, 1)) { }
41 
42  explicit ColumnVector (const dim_vector& dv)
43  : MArray<double> (dv.as_column ()) { }
44 
45  ColumnVector (octave_idx_type n, double val)
46  : MArray<double> (dim_vector (n, 1), val) { }
47 
48  ColumnVector (const ColumnVector& a) : MArray<double> (a) { }
49 
50  ColumnVector (const MArray<double>& a) : MArray<double> (a.as_column ()) { }
51  ColumnVector (const Array<double>& a) : MArray<double> (a.as_column ()) { }
52 
54  {
56  return *this;
57  }
58 
59  bool operator == (const ColumnVector& a) const;
60  bool operator != (const ColumnVector& a) const;
61 
62  // destructive insert/delete/reorder operations
63 
65 
66  ColumnVector& fill (double val);
67  ColumnVector& fill (double val, octave_idx_type r1, octave_idx_type r2);
68 
69  ColumnVector stack (const ColumnVector& a) const;
70 
71  RowVector transpose (void) const;
72 
73  friend OCTAVE_API ColumnVector real (const ComplexColumnVector& a);
74  friend OCTAVE_API ColumnVector imag (const ComplexColumnVector& a);
75 
76  // resize is the destructive equivalent for this one
77 
79 
80  ColumnVector extract_n (octave_idx_type r1, octave_idx_type n) const;
81 
82  // matrix by column vector -> column vector operations
83 
84  friend OCTAVE_API ColumnVector operator * (const Matrix& a,
85  const ColumnVector& b);
86 
87  // diagonal matrix by column vector -> column vector operations
88 
89  friend OCTAVE_API ColumnVector operator * (const DiagMatrix& a,
90  const ColumnVector& b);
91 
92  // other operations
93 
94  double min (void) const;
95  double max (void) const;
96 
97  ColumnVector abs (void) const;
98 
99  // i/o
100 
101  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
102  const ColumnVector& a);
103  friend OCTAVE_API std::istream& operator >> (std::istream& is,
104  ColumnVector& a);
105 
106  void resize (octave_idx_type n, const double& rfv = 0)
107  {
108  Array<double>::resize (dim_vector (n, 1), rfv);
109  }
110 
112  { Array<double>::clear (n, 1); }
113 
114 };
115 
116 // Publish externally used friend functions.
117 
118 extern OCTAVE_API ColumnVector real (const ComplexColumnVector& a);
119 extern OCTAVE_API ColumnVector imag (const ComplexColumnVector& a);
120 
122 
123 #endif
OCTAVE_API ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:156
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
void clear(octave_idx_type n)
Definition: dColVector.h:111
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
SparseBoolMatrix & operator=(const SparseBoolMatrix &a)
Definition: boolSparse.h:77
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
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
ColumnVector(const dim_vector &dv)
Definition: dColVector.h:42
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
SparseBoolMatrix & insert(const SparseBoolMatrix &a, octave_idx_type r, octave_idx_type c)
Definition: boolSparse.cc:75
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray-decl.h:236
Definition: dMatrix.h:35
OCTAVE_API ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:162
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
ColumnVector(void)
Definition: dColVector.h:37
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:233
void clear(void)
Definition: Array.cc:84
ColumnVector(const ColumnVector &a)
Definition: dColVector.h:48
ColumnVector(const MArray< double > &a)
Definition: dColVector.h:50
ColumnVector(const Array< double > &a)
Definition: dColVector.h:51
ColumnVector(octave_idx_type n, double val)
Definition: dColVector.h:45
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 r1
ColumnVector operator*(const ColumnVector &x, const double &y)
Definition: dColVector.h:121
T abs(T x)
Definition: pr-output.cc:3062
ColumnVector(octave_idx_type n)
Definition: dColVector.h:39
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:65
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:210
void resize(octave_idx_type n, const double &rfv=0)
Definition: dColVector.h:106