GNU Octave  4.2.1
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-2017 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 "octave-config.h"
27 
28 #include "MArray.h"
29 
30 #include "mx-defs.h"
31 
32 class
33 OCTAVE_API
35 {
36 public:
37 
38  FloatRowVector (void) : MArray<float> (dim_vector (1, 0)) { }
39 
41  : MArray<float> (dim_vector (1, n)) { }
42 
43  explicit FloatRowVector (const dim_vector& dv)
44  : MArray<float> (dv.as_row ()) { }
45 
47  : MArray<float> (dim_vector (1, n), val) { }
48 
49  FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { }
50 
51  FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { }
52 
53  FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { }
54 
56  {
58  return *this;
59  }
60 
61  bool operator == (const FloatRowVector& a) const;
62  bool operator != (const FloatRowVector& a) const;
63 
64  // destructive insert/delete/reorder operations
65 
67 
68  FloatRowVector& fill (float val);
70 
71  FloatRowVector append (const FloatRowVector& a) const;
72 
73  FloatColumnVector transpose (void) const;
74 
75  friend OCTAVE_API FloatRowVector real (const FloatComplexRowVector& a);
76  friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a);
77 
78  // resize is the destructive equivalent for this one
79 
80  FloatRowVector extract (octave_idx_type c1, octave_idx_type c2) const;
81 
82  FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
83 
84  // row vector by matrix -> row vector
85 
86  friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a,
87  const FloatMatrix& b);
88 
89  // other operations
90 
91  float min (void) const;
92  float max (void) const;
93 
94  // i/o
95 
96  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
97  const FloatRowVector& a);
98  friend OCTAVE_API std::istream& operator >> (std::istream& is,
99  FloatRowVector& a);
100 
101  void resize (octave_idx_type n, const float& rfv = 0)
102  {
103  Array<float>::resize (dim_vector (1, n), rfv);
104  }
105 
107  { Array<float>::clear (1, n); }
108 
109 };
110 
111 // row vector by column vector -> scalar
112 
113 float OCTAVE_API operator * (const FloatRowVector& a,
114  const FloatColumnVector& b);
115 
116 Complex OCTAVE_API operator * (const FloatRowVector& a,
117  const ComplexColumnVector& b);
118 
119 // other operations
120 
121 OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n);
122 
124 
125 #endif
FloatRowVector(const Array< float > &a)
Definition: fRowVector.h:53
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:567
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
void fill(const FloatComplex &val)
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
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:58
FloatRowVector(const MArray< float > &a)
Definition: fRowVector.h:51
Array< FloatComplex > as_row(void) const
Return the array as a row vector.
Definition: Array.h:377
FloatRowVector(octave_idx_type n)
Definition: fRowVector.h:40
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray.h:126
FloatComplexNDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: fCNDArray.cc:751
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:398
FloatRowVector(const dim_vector &dv)
Definition: fRowVector.h:43
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1028
bool append
Definition: load-save.cc:1582
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:538
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:228
void clear(void)
Definition: Array.cc:95
void resize(octave_idx_type n, const float &rfv=0)
Definition: fRowVector.h:101
float OCTAVE_API operator*(const FloatRowVector &a, const FloatColumnVector &b)
Definition: fRowVector.cc:291
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
FloatRowVector(const FloatRowVector &a)
Definition: fRowVector.h:49
FloatRowVector(void)
Definition: fRowVector.h:38
void clear(octave_idx_type n)
Definition: fRowVector.h:106
FloatRowVector(octave_idx_type n, float val)
Definition: fRowVector.h:46
b
Definition: cellfun.cc:398
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:142
std::complex< double > Complex
Definition: oct-cmplx.h:31
OCTAVE_API FloatRowVector linspace(float x1, float x2, octave_idx_type n)
Definition: fRowVector.cc:268
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:136
write the output to stdout if nargout is
Definition: load-save.cc:1576
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
dim_vector dv
Definition: sub2ind.cc:263
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:85
charNDArray min(char d, const charNDArray &m)
Definition: chNDArray.cc:205