fRowVector.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1994-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_FloatRowVector_h)
00024 #define octave_FloatRowVector_h 1
00025 
00026 #include "MArray.h"
00027 
00028 #include "mx-defs.h"
00029 
00030 class
00031 OCTAVE_API
00032 FloatRowVector : public MArray<float>
00033 {
00034 public:
00035 
00036   FloatRowVector (void) : MArray<float> (dim_vector (1, 0)) { }
00037 
00038   explicit FloatRowVector (octave_idx_type n)
00039     : MArray<float> (dim_vector (1, n)) { }
00040 
00041   explicit FloatRowVector (const dim_vector& dv)
00042     : MArray<float> (dv.as_row ()) { }
00043 
00044   FloatRowVector (octave_idx_type n, float val)
00045     : MArray<float> (dim_vector (1, n), val) { }
00046 
00047   FloatRowVector (const FloatRowVector& a) : MArray<float> (a) { }
00048 
00049   FloatRowVector (const MArray<float>& a) : MArray<float> (a.as_row ()) { }
00050 
00051   FloatRowVector (const Array<float>& a) : MArray<float> (a.as_row ()) { }
00052 
00053   FloatRowVector& operator = (const FloatRowVector& a)
00054     {
00055       MArray<float>::operator = (a);
00056       return *this;
00057     }
00058 
00059   bool operator == (const FloatRowVector& a) const;
00060   bool operator != (const FloatRowVector& a) const;
00061 
00062   // destructive insert/delete/reorder operations
00063 
00064   FloatRowVector& insert (const FloatRowVector& a, octave_idx_type c);
00065 
00066   FloatRowVector& fill (float val);
00067   FloatRowVector& fill (float val, octave_idx_type c1, octave_idx_type c2);
00068 
00069   FloatRowVector append (const FloatRowVector& a) const;
00070 
00071   FloatColumnVector transpose (void) const;
00072 
00073   friend OCTAVE_API FloatRowVector real (const FloatComplexRowVector& a);
00074   friend OCTAVE_API FloatRowVector imag (const FloatComplexRowVector& a);
00075 
00076   // resize is the destructive equivalent for this one
00077 
00078   FloatRowVector extract (octave_idx_type c1, octave_idx_type c2) const;
00079 
00080   FloatRowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
00081 
00082   // row vector by matrix -> row vector
00083 
00084   friend OCTAVE_API FloatRowVector operator * (const FloatRowVector& a, const FloatMatrix& b);
00085 
00086   // other operations
00087 
00088   float min (void) const;
00089   float max (void) const;
00090 
00091   // i/o
00092 
00093   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatRowVector& a);
00094   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatRowVector& a);
00095 
00096   void resize (octave_idx_type n,
00097                const float& rfv = Array<float>::resize_fill_value ())
00098   {
00099     Array<float>::resize (dim_vector (1, n), rfv);
00100   }
00101 
00102   void clear (octave_idx_type n)
00103     { Array<float>::clear (1, n); }
00104 
00105 };
00106 
00107 // row vector by column vector -> scalar
00108 
00109 float OCTAVE_API operator * (const FloatRowVector& a, const FloatColumnVector& b);
00110 
00111 Complex OCTAVE_API operator * (const FloatRowVector& a, const ComplexColumnVector& b);
00112 
00113 // other operations
00114 
00115 OCTAVE_API FloatRowVector linspace (float x1, float x2, octave_idx_type n);
00116 
00117 MARRAY_FORWARD_DEFS (MArray, FloatRowVector, float)
00118 
00119 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines