dRowVector.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_RowVector_h)
00024 #define octave_RowVector_h 1
00025 
00026 #include "MArray.h"
00027 
00028 #include "mx-defs.h"
00029 
00030 class
00031 OCTAVE_API
00032 RowVector : public MArray<double>
00033 {
00034 public:
00035 
00036   RowVector (void) : MArray<double> (dim_vector (1, 0)) { }
00037 
00038   explicit RowVector (octave_idx_type n)
00039     : MArray<double> (dim_vector (1, n)) { }
00040 
00041   explicit RowVector (const dim_vector& dv) : MArray<double> (dv.as_row ()) { }
00042 
00043   RowVector (octave_idx_type n, double val)
00044     : MArray<double> (dim_vector (1, n), val) { }
00045 
00046   RowVector (const RowVector& a) : MArray<double> (a) { }
00047 
00048   RowVector (const MArray<double>& a) : MArray<double> (a.as_row ()) { }
00049 
00050   RowVector (const Array<double>& a) : MArray<double> (a.as_row ()) { }
00051 
00052   RowVector& operator = (const RowVector& a)
00053     {
00054       MArray<double>::operator = (a);
00055       return *this;
00056     }
00057 
00058   bool operator == (const RowVector& a) const;
00059   bool operator != (const RowVector& a) const;
00060 
00061   // destructive insert/delete/reorder operations
00062 
00063   RowVector& insert (const RowVector& a, octave_idx_type c);
00064 
00065   RowVector& fill (double val);
00066   RowVector& fill (double val, octave_idx_type c1, octave_idx_type c2);
00067 
00068   RowVector append (const RowVector& a) const;
00069 
00070   ColumnVector transpose (void) const;
00071 
00072   friend OCTAVE_API RowVector real (const ComplexRowVector& a);
00073   friend OCTAVE_API RowVector imag (const ComplexRowVector& a);
00074 
00075   // resize is the destructive equivalent for this one
00076 
00077   RowVector extract (octave_idx_type c1, octave_idx_type c2) const;
00078 
00079   RowVector extract_n (octave_idx_type c1, octave_idx_type n) const;
00080 
00081   // row vector by matrix -> row vector
00082 
00083   friend OCTAVE_API RowVector operator * (const RowVector& a, const Matrix& b);
00084 
00085   // other operations
00086 
00087   double min (void) const;
00088   double max (void) const;
00089 
00090   // i/o
00091 
00092   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const RowVector& a);
00093   friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a);
00094 
00095   void resize (octave_idx_type n,
00096                const double& rfv = Array<double>::resize_fill_value ())
00097   {
00098     Array<double>::resize (dim_vector (1, n), rfv);
00099   }
00100 
00101   void clear (octave_idx_type n)
00102     { Array<double>::clear (1, n); }
00103 
00104 };
00105 
00106 // row vector by column vector -> scalar
00107 
00108 double OCTAVE_API operator * (const RowVector& a, const ColumnVector& b);
00109 
00110 Complex OCTAVE_API operator * (const RowVector& a, const ComplexColumnVector& b);
00111 
00112 // other operations
00113 
00114 OCTAVE_API RowVector linspace (double x1, double x2, octave_idx_type n);
00115 
00116 MARRAY_FORWARD_DEFS (MArray, RowVector, double)
00117 
00118 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines