GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
fRowVector.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1994-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://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 #include "mx-defs.h"
30 
31 class
32 OCTAVE_API
34 {
35 public:
36 
37  FloatRowVector (void) : MArray<float> (dim_vector (1, 0)) { }
38 
40  : MArray<float> (dim_vector (1, n)) { }
41 
42  explicit FloatRowVector (const dim_vector& dv)
43  : MArray<float> (dv.as_row ()) { }
44 
46  : MArray<float> (dim_vector (1, n), val) { }
47 
49 
51 
53 
55  {
57  return *this;
58  }
59 
60  bool operator == (const FloatRowVector& a) const;
61  bool operator != (const FloatRowVector& a) const;
62 
63  // destructive insert/delete/reorder operations
64 
66 
67  FloatRowVector& fill (float val);
69 
70  FloatRowVector append (const FloatRowVector& a) const;
71 
72  FloatColumnVector transpose (void) const;
73 
74  friend OCTAVE_API FloatRowVector real (const FloatComplexRowVector& a);
75  friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a);
76 
77  // resize is the destructive equivalent for this one
78 
79  FloatRowVector extract (octave_idx_type c1, octave_idx_type c2) const;
80 
81  FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
82 
83  // row vector by matrix -> row vector
84 
85  friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a,
86  const FloatMatrix& b);
87 
88  // other operations
89 
90  float min (void) const;
91  float max (void) const;
92 
93  // i/o
94 
95  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
96  const FloatRowVector& a);
97  friend OCTAVE_API std::istream& operator >> (std::istream& is,
98  FloatRowVector& a);
99 
100  void resize (octave_idx_type n, const float& rfv = 0)
101  {
102  Array<float>::resize (dim_vector (1, n), rfv);
103  }
104 
106  { Array<float>::clear (1, n); }
107 
108 };
109 
110 // row vector by column vector -> scalar
111 
112 float OCTAVE_API operator * (const FloatRowVector& a,
113  const FloatColumnVector& b);
114 
115 Complex OCTAVE_API operator * (const FloatRowVector& a,
116  const ComplexColumnVector& b);
117 
118 // other operations
119 
120 OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n);
121 
123 
124 #endif
FloatRowVector(const Array< float > &a)
Definition: fRowVector.h:52
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
void fill(const FloatComplex &val)
Definition: Array.cc:72
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
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
FloatComplexNDArray & operator=(const FloatComplexNDArray &a)
Definition: fCNDArray.h:57
FloatRowVector(const MArray< float > &a)
Definition: fRowVector.h:50
FloatRowVector(octave_idx_type n)
Definition: fRowVector.h:39
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
#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:749
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
FloatRowVector(const dim_vector &dv)
Definition: fRowVector.h:42
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
Definition: Array.cc:1010
bool append
Definition: load-save.cc:1618
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:550
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:85
Array< FloatComplex > as_row(void) const
Return the array as a row vector.
Definition: Array.h:380
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:227
void clear(void)
Definition: Array.cc:86
void resize(octave_idx_type n, const float &rfv=0)
Definition: fRowVector.h:100
float OCTAVE_API operator*(const FloatRowVector &a, const FloatColumnVector &b)
Definition: fRowVector.cc:290
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
FloatRowVector(const FloatRowVector &a)
Definition: fRowVector.h:48
FloatRowVector(void)
Definition: fRowVector.h:37
void clear(octave_idx_type n)
Definition: fRowVector.h:105
FloatRowVector(octave_idx_type n, float val)
Definition: fRowVector.h:45
b
Definition: cellfun.cc:400
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:141
std::complex< double > Complex
Definition: oct-cmplx.h:31
OCTAVE_API FloatRowVector linspace(float x1, float x2, octave_idx_type n)
Definition: fRowVector.cc:267
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:135
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
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