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
dRowVector.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_dRowVector_h)
24 #define octave_dRowVector_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  RowVector (void) : MArray<double> (dim_vector (1, 0)) { }
39 
41  : MArray<double> (dim_vector (1, n)) { }
42 
43  explicit RowVector (const dim_vector& dv) : MArray<double> (dv.as_row ()) { }
44 
46  : MArray<double> (dim_vector (1, n), val) { }
47 
48  RowVector (const RowVector& a) : MArray<double> (a) { }
49 
50  RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { }
51 
52  RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { }
53 
55  {
57  return *this;
58  }
59 
60  bool operator == (const RowVector& a) const;
61  bool operator != (const RowVector& a) const;
62 
63  // destructive insert/delete/reorder operations
64 
66 
67  RowVector& fill (double val);
69 
70  RowVector append (const RowVector& a) const;
71 
72  ColumnVector transpose (void) const;
73 
74  friend OCTAVE_API RowVector real (const ComplexRowVector& a);
75  friend OCTAVE_API RowVector imag (const ComplexRowVector& a);
76 
77  // resize is the destructive equivalent for this one
78 
79  RowVector extract (octave_idx_type c1, octave_idx_type c2) const;
80 
81  RowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
82 
83  // row vector by matrix -> row vector
84 
85  friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b);
86 
87  // other operations
88 
89  double min (void) const;
90  double max (void) const;
91 
92  // i/o
93 
94  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
95  const RowVector& a);
96  friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a);
97 
98  void resize (octave_idx_type n, const double& rfv = 0)
99  {
100  Array<double>::resize (dim_vector (1, n), rfv);
101  }
102 
104  { Array<double>::clear (1, n); }
105 
106 };
107 
108 // row vector by column vector -> scalar
109 
110 double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b);
111 
112 Complex OCTAVE_API operator * (const RowVector& a,
113  const ComplexColumnVector& b);
114 
115 // other operations
116 
117 OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n);
118 
120 
121 #endif
RowVector(const dim_vector &dv)
Definition: dRowVector.h:43
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:567
void resize(octave_idx_type n, const double &rfv=0)
Definition: dRowVector.h:98
OCTAVE_API RowVector linspace(double x1, double x2, octave_idx_type n)
Definition: dRowVector.cc:268
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
void fill(const Complex &val)
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
RowVector(void)
Definition: dRowVector.h:38
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
RowVector(const Array< double > &a)
Definition: dRowVector.h:52
RowVector(octave_idx_type n, double val)
Definition: dRowVector.h:45
Array< Complex > as_row(void) const
Return the array as a row vector.
Definition: Array.h:377
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray.h:126
RowVector(const MArray< double > &a)
Definition: dRowVector.h:50
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
ComplexNDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: CNDArray.cc:745
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1028
RowVector(octave_idx_type n)
Definition: dRowVector.h:40
bool append
Definition: load-save.cc:1582
ComplexNDArray & operator=(const ComplexNDArray &a)
Definition: CNDArray.h:57
Definition: dMatrix.h:37
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
double OCTAVE_API operator*(const RowVector &a, const ColumnVector &b)
Definition: dRowVector.cc:291
RowVector(const RowVector &a)
Definition: dRowVector.h:48
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:228
void clear(void)
Definition: Array.cc:95
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
issues an error eealso double
Definition: ov-bool-mat.cc:594
b
Definition: cellfun.cc:398
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:142
void clear(octave_idx_type n)
Definition: dRowVector.h:103
std::complex< double > Complex
Definition: oct-cmplx.h:31
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