dColVector.h

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