GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
fColVector.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2018 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
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License 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 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_fColVector_h)
25 #define octave_fColVector_h 1
26 
27 #include "octave-config.h"
28 
29 #include "MArray.h"
30 #include "mx-defs.h"
31 
32 class
33 OCTAVE_API
35 {
36 public:
37 
38  FloatColumnVector (void) : MArray<float> (dim_vector (0, 1)) { }
39 
41  : MArray<float> (dim_vector (n, 1)) { }
42 
43  explicit FloatColumnVector (const dim_vector& dv)
44  : MArray<float> (dv.as_column ()) { }
45 
47  : MArray<float> (dim_vector (n, 1), val) { }
48 
50 
52  : MArray<float> (a.as_column ()) { }
53 
55  : MArray<float> (a.as_column ()) { }
56 
58  {
60  return *this;
61  }
62 
63  bool operator == (const FloatColumnVector& a) const;
64  bool operator != (const FloatColumnVector& a) const;
65 
66  // destructive insert/delete/reorder operations
67 
69 
70  FloatColumnVector& fill (float val);
72 
73  FloatColumnVector stack (const FloatColumnVector& a) const;
74 
75  FloatRowVector transpose (void) const;
76 
77  friend OCTAVE_API FloatColumnVector real (const FloatComplexColumnVector& a);
78  friend OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a);
79 
80  // resize is the destructive equivalent for this one
81 
83 
85 
86  // matrix by column vector -> column vector operations
87 
88  friend OCTAVE_API FloatColumnVector operator * (const FloatMatrix& a,
89  const FloatColumnVector& b);
90 
91  // diagonal matrix by column vector -> column vector operations
92 
93  friend OCTAVE_API FloatColumnVector operator * (const FloatDiagMatrix& a,
94  const FloatColumnVector& b);
95 
96  // other operations
97 
98  float min (void) const;
99  float max (void) const;
100 
101  FloatColumnVector abs (void) const;
102 
103  // i/o
104 
105  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
106  const FloatColumnVector& a);
107  friend OCTAVE_API std::istream& operator >> (std::istream& is,
109 
110  void resize (octave_idx_type n, const float& rfv = 0)
111  {
112  Array<float>::resize (dim_vector (n, 1), rfv);
113  }
114 
116  { Array<float>::clear (n, 1); }
117 
118 };
119 
120 // Publish externally used friend functions.
121 
122 extern OCTAVE_API FloatColumnVector real (const FloatComplexColumnVector& a);
123 extern OCTAVE_API FloatColumnVector imag (const FloatComplexColumnVector& a);
124 
126 
127 #endif
OCTAVE_API FloatColumnVector real(const FloatComplexColumnVector &a)
Definition: fColVector.cc:135
FloatComplexRowVector & fill(float val)
Definition: fCRowVector.cc:96
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
FloatComplexRowVector & operator=(const FloatComplexRowVector &a)
Definition: fCRowVector.h:64
FloatColumnVector operator*(const FloatColumnVector &x, const float &y)
Definition: fColVector.h:125
FloatColumnVector(const FloatColumnVector &a)
Definition: fColVector.h:49
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
FloatColumnVector(void)
Definition: fColVector.h:38
void resize(octave_idx_type n, const float &rfv=0)
Definition: fColVector.h:110
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
FloatColumnVector(const dim_vector &dv)
Definition: fColVector.h:43
void clear(octave_idx_type n)
Definition: fColVector.h:115
static T abs(T x)
Definition: pr-output.cc:1696
OCTAVE_API FloatColumnVector imag(const FloatComplexColumnVector &a)
Definition: fColVector.cc:141
FloatColumnVector(const Array< float > &a)
Definition: fColVector.h:54
#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
Array< FloatComplex > as_column(void) const
Return the array as a column vector.
Definition: Array.h:370
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
Definition: Array.cc:1010
FloatColumnVector(octave_idx_type n)
Definition: fColVector.h:40
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:550
FloatColumnVector(octave_idx_type n, float val)
Definition: fColVector.h:46
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:85
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
void clear(void)
Definition: Array.cc:86
FloatColumnVector(const MArray< float > &a)
Definition: fColVector.h:51
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
FloatComplexRowVector extract_n(octave_idx_type c1, octave_idx_type n) const
Definition: fCRowVector.cc:228
b
Definition: cellfun.cc:400
FloatComplexRowVector & insert(const FloatRowVector &a, octave_idx_type c)
Definition: fCRowVector.cc:57
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
FloatComplexRowVector extract(octave_idx_type c1, octave_idx_type c2) const
Definition: fCRowVector.cc:213
dim_vector dv
Definition: sub2ind.cc:263
octave::stream os
Definition: file-io.cc:627
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:204