GNU Octave  3.8.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-2013 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