op-cdm-cdm.cc

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 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include "gripes.h"
00028 #include "oct-obj.h"
00029 #include "ov.h"
00030 #include "ov-cx-mat.h"
00031 #include "ov-cx-diag.h"
00032 #include "ov-flt-cx-diag.h"
00033 #include "ov-typeinfo.h"
00034 #include "ops.h"
00035 #include "xdiv.h"
00036 #include "xpow.h"
00037 
00038 // matrix unary ops.
00039 
00040 DEFUNOP_OP (uplus, complex_diag_matrix, /* no-op */)
00041 DEFUNOP_OP (uminus, complex_diag_matrix, -)
00042 
00043 DEFUNOP (transpose, complex_diag_matrix)
00044 {
00045   CAST_UNOP_ARG (const octave_complex_diag_matrix&);
00046   return octave_value (v.complex_diag_matrix_value().transpose ());
00047 }
00048 
00049 DEFUNOP (hermitian, complex_diag_matrix)
00050 {
00051   CAST_UNOP_ARG (const octave_complex_diag_matrix&);
00052   return octave_value (v.complex_diag_matrix_value().hermitian ());
00053 }
00054 
00055 // matrix by matrix ops.
00056 
00057 DEFBINOP_OP (add, complex_diag_matrix, complex_diag_matrix, +)
00058 DEFBINOP_OP (sub, complex_diag_matrix, complex_diag_matrix, -)
00059 DEFBINOP_OP (mul, complex_diag_matrix, complex_diag_matrix, *)
00060 
00061 DEFBINOP (div, complex_diag_matrix, complex_diag_matrix)
00062 {
00063   CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&);
00064 
00065   return xdiv (v1.complex_diag_matrix_value (),
00066                v2.complex_diag_matrix_value ());
00067 }
00068 
00069 DEFBINOP (ldiv, complex_diag_matrix, complex_diag_matrix)
00070 {
00071   CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_complex_diag_matrix&);
00072 
00073   return xleftdiv (v1.complex_diag_matrix_value (),
00074                    v2.complex_diag_matrix_value ());
00075 }
00076 
00077 CONVDECL (complex_diag_matrix_to_complex_matrix)
00078 {
00079   CAST_CONV_ARG (const octave_complex_diag_matrix&);
00080 
00081   return new octave_complex_matrix (v.complex_matrix_value ());
00082 }
00083 
00084 CONVDECL (complex_diag_matrix_to_float_complex_diag_matrix)
00085 {
00086   CAST_CONV_ARG (const octave_complex_diag_matrix&);
00087 
00088   return new octave_float_complex_diag_matrix (v.float_complex_diag_matrix_value ());
00089 }
00090 
00091 void
00092 install_cdm_cdm_ops (void)
00093 {
00094   INSTALL_UNOP (op_uplus, octave_complex_diag_matrix, uplus);
00095   INSTALL_UNOP (op_uminus, octave_complex_diag_matrix, uminus);
00096   INSTALL_UNOP (op_transpose, octave_complex_diag_matrix, transpose);
00097   INSTALL_UNOP (op_hermitian, octave_complex_diag_matrix, hermitian);
00098 
00099   INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_complex_diag_matrix, add);
00100   INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_complex_diag_matrix, sub);
00101   INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_complex_diag_matrix, mul);
00102   INSTALL_BINOP (op_div, octave_complex_diag_matrix, octave_complex_diag_matrix, div);
00103   INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_complex_diag_matrix, ldiv);
00104 
00105   INSTALL_CONVOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix);
00106   INSTALL_CONVOP (octave_complex_diag_matrix, octave_float_complex_diag_matrix,
00107                   complex_diag_matrix_to_float_complex_diag_matrix);
00108   INSTALL_ASSIGNCONV (octave_complex_diag_matrix, octave_complex_matrix, octave_complex_matrix);
00109   INSTALL_WIDENOP (octave_complex_diag_matrix, octave_complex_matrix, complex_diag_matrix_to_complex_matrix);
00110 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines