GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
dRowVector.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_dRowVector_h)
24 #define octave_dRowVector_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  RowVector (void) : MArray<double> (dim_vector (1, 0)) { }
38 
40  : MArray<double> (dim_vector (1, n)) { }
41 
42  explicit RowVector (const dim_vector& dv) : MArray<double> (dv.as_row ()) { }
43 
45  : MArray<double> (dim_vector (1, n), val) { }
46 
47  RowVector (const RowVector& a) : MArray<double> (a) { }
48 
50 
51  RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { }
52 
54  {
56  return *this;
57  }
58 
59  bool operator == (const RowVector& a) const;
60  bool operator != (const RowVector& a) const;
61 
62  // destructive insert/delete/reorder operations
63 
65 
66  RowVector& fill (double val);
68 
69  RowVector append (const RowVector& a) const;
70 
71  ColumnVector transpose (void) const;
72 
73  friend OCTAVE_API RowVector real (const ComplexRowVector& a);
74  friend OCTAVE_API RowVector imag (const ComplexRowVector& a);
75 
76  // resize is the destructive equivalent for this one
77 
78  RowVector extract (octave_idx_type c1, octave_idx_type c2) const;
79 
80  RowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
81 
82  // row vector by matrix -> row vector
83 
84  friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b);
85 
86  // other operations
87 
88  double min (void) const;
89  double max (void) const;
90 
91  // i/o
92 
93  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
94  const RowVector& a);
95  friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a);
96 
97  void resize (octave_idx_type n, const double& rfv = 0)
98  {
99  Array<double>::resize (dim_vector (1, n), rfv);
100  }
101 
103  { Array<double>::clear (1, n); }
104 
105 };
106 
107 // row vector by column vector -> scalar
108 
109 double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b);
110 
111 Complex OCTAVE_API operator * (const RowVector& a,
112  const ComplexColumnVector& b);
113 
114 // other operations
115 
116 OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n);
117 
119 
120 #endif
RowVector(const dim_vector &dv)
Definition: dRowVector.h:42
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:566
void resize(octave_idx_type n, const double &rfv=0)
Definition: dRowVector.h:97
OCTAVE_API RowVector linspace(double x1, double x2, octave_idx_type n)
Definition: dRowVector.cc:267
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
void fill(const Complex &val)
Definition: Array.cc:72
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
RowVector(void)
Definition: dRowVector.h:37
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
RowVector(const Array< double > &a)
Definition: dRowVector.h:51
RowVector(octave_idx_type n, double val)
Definition: dRowVector.h:44
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
RowVector(const MArray< double > &a)
Definition: dRowVector.h:49
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
ComplexNDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: CNDArray.cc:743
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
Definition: Array.cc:1010
RowVector(octave_idx_type n)
Definition: dRowVector.h:39
bool append
Definition: load-save.cc:1618
ComplexNDArray & operator=(const ComplexNDArray &a)
Definition: CNDArray.h:56
Definition: dMatrix.h:36
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:550
double OCTAVE_API operator*(const RowVector &a, const ColumnVector &b)
Definition: dRowVector.cc:290
RowVector(const RowVector &a)
Definition: dRowVector.h:47
MArray< T > & operator=(const MArray< T > &a)
Definition: MArray.h:85
Array< Complex > 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
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
b
Definition: cellfun.cc:400
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:141
void clear(octave_idx_type n)
Definition: dRowVector.h:102
std::complex< double > Complex
Definition: oct-cmplx.h:31
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