op-chm.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-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 #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-ch-mat.h"
00031 #include "ov-scalar.h"
00032 #include "ov-re-mat.h"
00033 #include "ov-bool.h"
00034 #include "ov-bool-mat.h"
00035 #include "ov-typeinfo.h"
00036 #include "ops.h"
00037 
00038 // char matrix unary ops.
00039 
00040 DEFUNOP (transpose, char_matrix)
00041 {
00042   CAST_UNOP_ARG (const octave_char_matrix&);
00043 
00044   return octave_value (v.matrix_value().transpose ());
00045 }
00046 
00047 DEFNDCATOP_FN (chm_chm, char_matrix, char_matrix, char_array, char_array,
00048                concat)
00049 
00050 DEFCATOP (chm_s, char_matrix, scalar)
00051 {
00052   CAST_BINOP_ARGS (octave_char_matrix&, const octave_scalar&);
00053 
00054   gripe_implicit_conversion ("Octave:num-to-str",
00055                              v2.type_name (), v1.type_name ());
00056 
00057   return octave_value (v1.char_array_value (). concat(v2.array_value (),
00058                                ra_idx));
00059 }
00060 
00061 DEFCATOP (chm_m, char_matrix, matrix)
00062 {
00063   CAST_BINOP_ARGS (octave_char_matrix&, const octave_matrix&);
00064 
00065   gripe_implicit_conversion ("Octave:num-to-str",
00066                              v2.type_name (), v1.type_name ());
00067 
00068   return octave_value (v1.char_array_value (). concat (v2.array_value (),
00069                                ra_idx));
00070 }
00071 
00072 DEFCATOP (s_chm, scalar, char_matrix)
00073 {
00074   CAST_BINOP_ARGS (octave_scalar&, const octave_char_matrix&);
00075 
00076   gripe_implicit_conversion ("Octave:num-to-str",
00077                              v1.type_name (), v2.type_name ());
00078 
00079   return octave_value (v1.array_value (). concat (v2.char_array_value (),
00080                                ra_idx));
00081 }
00082 
00083 DEFCATOP (m_chm, matrix, char_matrix)
00084 {
00085   CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix&);
00086 
00087   gripe_implicit_conversion ("Octave:num-to-str",
00088                              v1.type_name (), v2.type_name ());
00089 
00090   return octave_value (v1.array_value (). concat (v2.char_array_value (),
00091                                ra_idx));
00092 }
00093 
00094 void
00095 install_chm_ops (void)
00096 {
00097   INSTALL_UNOP (op_transpose, octave_char_matrix, transpose);
00098   INSTALL_UNOP (op_hermitian, octave_char_matrix, transpose);
00099 
00100   INSTALL_CATOP (octave_char_matrix, octave_char_matrix, chm_chm);
00101   INSTALL_CATOP (octave_char_matrix, octave_scalar, chm_s);
00102   INSTALL_CATOP (octave_char_matrix, octave_matrix, chm_m);
00103   INSTALL_CATOP (octave_scalar, octave_char_matrix, s_chm);
00104   INSTALL_CATOP (octave_matrix, octave_char_matrix, m_chm);
00105 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines