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
fRowVector.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_fRowVector_h)
24 #define octave_fRowVector_h 1
25 
26 #include "MArray.h"
27 
28 #include "mx-defs.h"
29 
30 class
31 OCTAVE_API
33 {
34 public:
35 
36  FloatRowVector (void) : MArray<float> (dim_vector (1, 0)) { }
37 
39  : MArray<float> (dim_vector (1, n)) { }
40 
41  explicit FloatRowVector (const dim_vector& dv)
42  : MArray<float> (dv.as_row ()) { }
43 
45  : MArray<float> (dim_vector (1, n), val) { }
46 
47  FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { }
48 
49  FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { }
50 
51  FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { }
52 
54  {
56  return *this;
57  }
58 
59  bool operator == (const FloatRowVector& a) const;
60  bool operator != (const FloatRowVector& a) const;
61 
62  // destructive insert/delete/reorder operations
63 
65 
66  FloatRowVector& fill (float val);
68 
69  FloatRowVector append (const FloatRowVector& a) const;
70 
71  FloatColumnVector transpose (void) const;
72 
73  friend OCTAVE_API FloatRowVector real (const FloatComplexRowVector& a);
74  friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a);
75 
76  // resize is the destructive equivalent for this one
77 
79 
80  FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
81 
82  // row vector by matrix -> row vector
83 
84  friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a,
85  const FloatMatrix& b);
86 
87  // other operations
88 
89  float min (void) const;
90  float max (void) const;
91 
92  // i/o
93 
94  friend OCTAVE_API std::ostream& operator << (std::ostream& os,
95  const FloatRowVector& a);
96  friend OCTAVE_API std::istream& operator >> (std::istream& is,
97  FloatRowVector& a);
98 
99  void resize (octave_idx_type n, const float& rfv = 0)
100  {
101  Array<float>::resize (dim_vector (1, n), rfv);
102  }
103 
105  { Array<float>::clear (1, n); }
106 
107 };
108 
109 // row vector by column vector -> scalar
110 
111 float OCTAVE_API operator * (const FloatRowVector& a,
112  const FloatColumnVector& b);
113 
114 Complex OCTAVE_API operator * (const FloatRowVector& a,
115  const ComplexColumnVector& b);
116 
117 // other operations
118 
119 OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n);
120 
122 
123 #endif