ov-cx-sparse.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2004-2012 David Bateman
00004 Copyright (C) 1998-2004 Andy Adler
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_sparse_complex_matrix_h)
00025 #define octave_sparse_complex_matrix_h 1
00026 
00027 #include <cstdlib>
00028 
00029 #include <iosfwd>
00030 #include <string>
00031 
00032 #include "mx-base.h"
00033 #include "oct-alloc.h"
00034 #include "str-vec.h"
00035 
00036 #include "error.h"
00037 #include "oct-stream.h"
00038 #include "ov-base.h"
00039 #include "ov-typeinfo.h"
00040 
00041 #include "CSparse.h"
00042 #include "ov-base-sparse.h"
00043 #include "ov-re-sparse.h"
00044 
00045 class octave_value_list;
00046 
00047 class tree_walker;
00048 
00049 class
00050 OCTINTERP_API
00051 octave_sparse_complex_matrix : public octave_base_sparse<SparseComplexMatrix>
00052 {
00053 public:
00054 
00055   octave_sparse_complex_matrix (void)
00056     : octave_base_sparse<SparseComplexMatrix> () { }
00057 
00058   octave_sparse_complex_matrix (const ComplexNDArray& m)
00059     : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
00060 
00061   octave_sparse_complex_matrix (const ComplexMatrix& m)
00062     : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
00063 
00064   octave_sparse_complex_matrix (const SparseComplexMatrix& m)
00065     : octave_base_sparse<SparseComplexMatrix> (m) { }
00066 
00067   octave_sparse_complex_matrix (const SparseComplexMatrix& m,
00068                                 const MatrixType &t)
00069     : octave_base_sparse<SparseComplexMatrix> (m, t) { }
00070 
00071   octave_sparse_complex_matrix (const MSparse<Complex>& m)
00072     : octave_base_sparse<SparseComplexMatrix> (m) { }
00073 
00074   octave_sparse_complex_matrix (const MSparse<Complex>& m,
00075                                 const MatrixType &t)
00076     : octave_base_sparse<SparseComplexMatrix> (m, t) { }
00077 
00078   octave_sparse_complex_matrix (const Sparse<Complex>& m,
00079                                 const MatrixType &t)
00080     : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m), t) { }
00081 
00082   octave_sparse_complex_matrix (const Sparse<Complex>& m)
00083     : octave_base_sparse<SparseComplexMatrix> (SparseComplexMatrix (m)) { }
00084 
00085   octave_sparse_complex_matrix (const octave_sparse_complex_matrix& cm)
00086     : octave_base_sparse<SparseComplexMatrix> (cm) { }
00087 
00088   ~octave_sparse_complex_matrix (void) { }
00089 
00090   octave_base_value *clone (void) const { return new octave_sparse_complex_matrix (*this); }
00091   octave_base_value *empty_clone (void) const { return new octave_sparse_complex_matrix (); }
00092 
00093   octave_base_value *try_narrowing_conversion (void);
00094 
00095   builtin_type_t builtin_type (void) const { return btyp_complex; }
00096 
00097   bool is_complex_matrix (void) const { return true; }
00098 
00099   bool is_complex_type (void) const { return true; }
00100 
00101   bool is_double_type (void) const { return true; }
00102 
00103   bool is_float_type (void) const { return true; }
00104 
00105   double double_value (bool = false) const;
00106 
00107   double scalar_value (bool frc_str_conv = false) const
00108     { return double_value (frc_str_conv); }
00109 
00110   Matrix matrix_value (bool = false) const;
00111 
00112   Complex complex_value (bool = false) const;
00113 
00114   ComplexMatrix complex_matrix_value (bool = false) const;
00115 
00116   ComplexNDArray complex_array_value (bool = false) const;
00117 
00118   charNDArray char_array_value (bool frc_str_conv = false) const;
00119 
00120   SparseMatrix sparse_matrix_value (bool = false) const;
00121 
00122   SparseComplexMatrix sparse_complex_matrix_value (bool = false) const
00123     { return matrix; }
00124 
00125   SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const;
00126 
00127 #if 0
00128   int write (octave_stream& os, int block_size,
00129              oct_data_conv::data_type output_type, int skip,
00130              oct_mach_info::float_format flt_fmt) const
00131     {
00132       // Yes, for compatibility, we drop the imaginary part here.
00133       return os.write (matrix_value (true), block_size, output_type,
00134                        skip, flt_fmt);
00135     }
00136 #endif
00137 
00138   bool save_binary (std::ostream& os, bool& save_as_floats);
00139 
00140   bool load_binary (std::istream& is, bool swap,
00141                     oct_mach_info::float_format fmt);
00142 
00143 #if defined (HAVE_HDF5)
00144   bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats);
00145 
00146   bool load_hdf5 (hid_t loc_id, const char *name);
00147 #endif
00148 
00149   mxArray *as_mxArray (void) const;
00150 
00151   octave_value map (unary_mapper_t umap) const;
00152 
00153 private:
00154 
00155   DECLARE_OCTAVE_ALLOCATOR
00156 
00157   DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
00158 };
00159 
00160 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines