ov-re-diag.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2008-2012 Jaroslav Hajek
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_diag_matrix_h)
00024 #define octave_diag_matrix_h 1
00025 
00026 #include "ov-base.h"
00027 #include "ov-base-diag.h"
00028 #include "ov-re-mat.h"
00029 #include "ov-typeinfo.h"
00030 
00031 // Real diagonal matrix values.
00032 
00033 class
00034 OCTINTERP_API
00035 octave_diag_matrix
00036   : public octave_base_diag<DiagMatrix, Matrix>
00037 {
00038 public:
00039 
00040   octave_diag_matrix (void)
00041     : octave_base_diag<DiagMatrix, Matrix> () { }
00042 
00043   octave_diag_matrix (const DiagMatrix& m)
00044     : octave_base_diag<DiagMatrix, Matrix> (m) { }
00045 
00046   octave_diag_matrix (const octave_diag_matrix& m)
00047     : octave_base_diag<DiagMatrix, Matrix> (m) { }
00048 
00049   ~octave_diag_matrix (void) { }
00050 
00051   octave_base_value *clone (void) const { return new octave_diag_matrix (*this); }
00052   octave_base_value *empty_clone (void) const { return new octave_diag_matrix (); }
00053 
00054   type_conv_info numeric_conversion_function (void) const;
00055 
00056   type_conv_info numeric_demotion_function (void) const;
00057 
00058   octave_base_value *try_narrowing_conversion (void);
00059 
00060   octave_value do_index_op (const octave_value_list& idx,
00061                             bool resize_ok = false);
00062 
00063   builtin_type_t builtin_type (void) const { return btyp_double; }
00064 
00065   bool is_real_matrix (void) const { return true; }
00066 
00067   bool is_real_type (void) const { return true; }
00068 
00069   bool is_double_type (void) const { return true; }
00070 
00071   bool is_float_type (void) const { return true; }
00072 
00073   DiagMatrix diag_matrix_value (bool = false) const;
00074 
00075   FloatDiagMatrix float_diag_matrix_value (bool = false) const;
00076 
00077   ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
00078 
00079   FloatComplexDiagMatrix float_complex_diag_matrix_value (bool = false) const;
00080 
00081   bool save_binary (std::ostream& os, bool& save_as_floats);
00082 
00083   bool load_binary (std::istream& is, bool swap,
00084                     oct_mach_info::float_format fmt);
00085 
00086   octave_value map (unary_mapper_t umap) const;
00087 
00088 private:
00089 
00090   bool chk_valid_scalar (const octave_value&,
00091                          double&) const;
00092 
00093   DECLARE_OCTAVE_ALLOCATOR
00094 
00095   DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
00096 };
00097 
00098 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines