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
fRowVector.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2015 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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_fRowVector_h)
24 #define octave_fRowVector_h 1
25 
26 #include "MArray.h"
27 
28 #include "mx-defs.h"
29 
30 class
31 OCTAVE_API
33 {
34 public:
35 
36  FloatRowVector (void) : MArray<float> (dim_vector (1, 0)) { }
37 
39  : MArray<float> (dim_vector (1, n)) { }
40 
41  explicit FloatRowVector (const dim_vector& dv)
42  : MArray<float> (dv.as_row ()) { }
43 
45  : MArray<float> (dim_vector (1, n), val) { }
46 
47  FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { }
48 
49  FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { }
50 
51  FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { }
52 
54  {
56  return *this;
57  }
58 
59  bool operator == (const FloatRowVector& a) const;
60  bool operator != (const FloatRowVector& a) const;
61 
62  // destructive insert/delete/reorder operations
63 
65 
66  FloatRowVector& fill (float val);
68 
69  FloatRowVector append (const FloatRowVector& a) const;
70 
71  FloatColumnVector transpose (void) const;
72 
73  friend OCTAVE_API FloatRowVector real (const FloatComplexRowVector& a);
74  friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a);
75 
76  // resize is the destructive equivalent for this one
77 
79 
80  FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
81 
82  // row vector by matrix -> row vector
83 
84  friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a,
85  const FloatMatrix& b);
86 
87  // other operations
88 
89  float min (void) const;
90  float max (void) const;
91 
92  // i/o
93 
94  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
95  const FloatRowVector& a);
96  friend OCTAVE_API std::istream& operator >> (std::istream& is,
97  FloatRowVector& a);
98 
99  void resize (octave_idx_type n, const float& rfv = 0)
100  {
101  Array<float>::resize (dim_vector (1, n), rfv);
102  }
103 
105  { Array<float>::clear (1, n); }
106 
107 };
108 
109 // row vector by column vector -> scalar
110 
111 float OCTAVE_API operator * (const FloatRowVector& a,
112  const FloatColumnVector& b);
113 
114 Complex OCTAVE_API operator * (const FloatRowVector& a,
115  const ComplexColumnVector& b);
116 
117 // other operations
118 
119 OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n);
120 
122 
123 #endif
FloatRowVector(const Array< float > &a)
Definition: fRowVector.h:51
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
void fill(const FloatComplex &val)
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
FloatComplexNDArray & operator=(const FloatComplexNDArray &a)
Definition: fCNDArray.h:56
FloatRowVector(const MArray< float > &a)
Definition: fRowVector.h:49
Array< FloatComplex > as_row(void) const
Return the array as a row vector.
Definition: Array.h:289
FloatRowVector(octave_idx_type n)
Definition: fRowVector.h:38
FloatComplexNDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: fCNDArray.cc:763
FloatRowVector(const dim_vector &dv)
Definition: fRowVector.h:41
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray-decl.h:236
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:233
void clear(void)
Definition: Array.cc:84
void resize(octave_idx_type n, const float &rfv=0)
Definition: fRowVector.h:99
float OCTAVE_API operator*(const FloatRowVector &a, const FloatColumnVector &b)
Definition: fRowVector.cc:312
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
FloatRowVector(const FloatRowVector &a)
Definition: fRowVector.h:47
FloatRowVector(void)
Definition: fRowVector.h:36
void clear(octave_idx_type n)
Definition: fRowVector.h:104
FloatRowVector(octave_idx_type n, float val)
Definition: fRowVector.h:44
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:162
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
std::complex< double > Complex
Definition: oct-cmplx.h:29
OCTAVE_API FloatRowVector linspace(float x1, float x2, octave_idx_type n)
Definition: fRowVector.cc:294
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:156
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:65
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:210