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
dRowVector.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_dRowVector_h)
24 #define octave_dRowVector_h 1
25 
26 #include "MArray.h"
27 
28 #include "mx-defs.h"
29 
30 class
31 OCTAVE_API
33 {
34 public:
35 
36  RowVector (void) : MArray<double> (dim_vector (1, 0)) { }
37 
39  : MArray<double> (dim_vector (1, n)) { }
40 
41  explicit RowVector (const dim_vector& dv) : MArray<double> (dv.as_row ()) { }
42 
43  RowVector (octave_idx_type n, double val)
44  : MArray<double> (dim_vector (1, n), val) { }
45 
46  RowVector (const RowVector& a) : MArray<double> (a) { }
47 
48  RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { }
49 
50  RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { }
51 
53  {
55  return *this;
56  }
57 
58  bool operator == (const RowVector& a) const;
59  bool operator != (const RowVector& a) const;
60 
61  // destructive insert/delete/reorder operations
62 
64 
65  RowVector& fill (double val);
66  RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2);
67 
68  RowVector append (const RowVector& a) const;
69 
70  ColumnVector transpose (void) const;
71 
72  friend OCTAVE_API RowVector real (const ComplexRowVector& a);
73  friend OCTAVE_API RowVector imag (const ComplexRowVector& a);
74 
75  // resize is the destructive equivalent for this one
76 
77  RowVector extract (octave_idx_type c1, octave_idx_type c2) const;
78 
79  RowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
80 
81  // row vector by matrix -> row vector
82 
83  friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b);
84 
85  // other operations
86 
87  double min (void) const;
88  double max (void) const;
89 
90  // i/o
91 
92  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
93  const RowVector& a);
94  friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a);
95 
96  void resize (octave_idx_type n, const double& rfv = 0)
97  {
98  Array<double>::resize (dim_vector (1, n), rfv);
99  }
100 
102  { Array<double>::clear (1, n); }
103 
104 };
105 
106 // row vector by column vector -> scalar
107 
108 double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b);
109 
110 Complex OCTAVE_API operator * (const RowVector& a,
111  const ComplexColumnVector& b);
112 
113 // other operations
114 
115 OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n);
116 
118 
119 #endif
RowVector(const dim_vector &dv)
Definition: dRowVector.h:41
bool operator!=(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:548
void resize(octave_idx_type n, const double &rfv=0)
Definition: dRowVector.h:96
OCTAVE_API RowVector linspace(double x1, double x2, octave_idx_type n)
Definition: dRowVector.cc:294
std::istream & operator>>(std::istream &is, SparseBoolMatrix &a)
Definition: boolSparse.cc:279
void fill(const Complex &val)
RowVector(void)
Definition: dRowVector.h:36
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:50
RowVector(octave_idx_type n, double val)
Definition: dRowVector.h:43
Array< Complex > as_row(void) const
Return the array as a row vector.
Definition: Array.h:289
RowVector(const MArray< double > &a)
Definition: dRowVector.h:48
ComplexNDArray & insert(const NDArray &a, octave_idx_type r, octave_idx_type c)
Definition: CNDArray.cc:753
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
RowVector(octave_idx_type n)
Definition: dRowVector.h:38
ComplexNDArray & operator=(const ComplexNDArray &a)
Definition: CNDArray.h:55
#define MARRAY_FORWARD_DEFS(B, R, T)
Definition: MArray-decl.h:236
Definition: dMatrix.h:35
bool operator==(const dim_vector &a, const dim_vector &b)
Definition: dim-vector.h:519
double OCTAVE_API operator*(const RowVector &a, const ColumnVector &b)
Definition: dRowVector.cc:312
RowVector(const RowVector &a)
Definition: dRowVector.h:46
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:233
void clear(void)
Definition: Array.cc:84
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
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
void clear(octave_idx_type n)
Definition: dRowVector.h:101
std::complex< double > Complex
Definition: oct-cmplx.h:29
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