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