op-sbm-sbm.cc

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 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027 
00028 #include "gripes.h"
00029 #include "oct-obj.h"
00030 #include "ov.h"
00031 #include "ov-typeinfo.h"
00032 #include "ov-bool-mat.h"
00033 #include "ov-scalar.h"
00034 #include "ops.h"
00035 
00036 #include "ov-re-sparse.h"
00037 #include "ov-bool-sparse.h"
00038 
00039 // unary sparse bool matrix ops.
00040 
00041 DEFUNOP_OP (not, sparse_bool_matrix, !)
00042 
00043 DEFUNOP (uplus, sparse_bool_matrix)
00044 {
00045   CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
00046   return octave_value (v.sparse_matrix_value ());
00047 }
00048 
00049 DEFUNOP (uminus, sparse_bool_matrix)
00050 {
00051   CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
00052   return octave_value ( - v.sparse_matrix_value ());
00053 }
00054 
00055 DEFUNOP (transpose, sparse_bool_matrix)
00056 {
00057   CAST_UNOP_ARG (const octave_sparse_bool_matrix&);
00058   return octave_value (v.sparse_bool_matrix_value().transpose ());
00059 }
00060 
00061 // sparse bool matrix by sparse bool matrix ops.
00062 
00063 DEFBINOP_FN (eq, sparse_bool_matrix, sparse_bool_matrix, mx_el_eq)
00064 DEFBINOP_FN (ne, sparse_bool_matrix, sparse_bool_matrix, mx_el_ne)
00065 DEFBINOP_FN (el_and, sparse_bool_matrix, sparse_bool_matrix, mx_el_and)
00066 DEFBINOP_FN (el_or,  sparse_bool_matrix, sparse_bool_matrix, mx_el_or)
00067 
00068 DEFNDCATOP_FN (sbm_sbm, sparse_bool_matrix, sparse_bool_matrix,
00069                sparse_bool_matrix, sparse_bool_matrix, concat)
00070 DEFNDCATOP_FN (sbm_sm, sparse_bool_matrix, sparse_matrix, sparse_matrix,
00071                sparse_matrix, concat)
00072 DEFNDCATOP_FN (sm_sbm, sparse_matrix, sparse_bool_matrix, sparse_matrix,
00073                sparse_matrix, concat)
00074 
00075 DEFASSIGNOP_FN (assign, sparse_bool_matrix, sparse_bool_matrix,
00076                 assign)
00077 
00078 CONVDECL (bool_matrix_to_double_matrix)
00079 {
00080   CAST_CONV_ARG (const octave_sparse_bool_matrix&);
00081 
00082   return new octave_sparse_matrix (SparseMatrix (v.sparse_bool_matrix_value ()));
00083 }
00084 
00085 void
00086 install_sbm_sbm_ops (void)
00087 {
00088   INSTALL_UNOP (op_not, octave_sparse_bool_matrix, not);
00089   INSTALL_UNOP (op_uplus, octave_sparse_bool_matrix, uplus);
00090   INSTALL_UNOP (op_uminus, octave_sparse_bool_matrix, uminus);
00091   INSTALL_UNOP (op_transpose, octave_sparse_bool_matrix, transpose);
00092   INSTALL_UNOP (op_hermitian, octave_sparse_bool_matrix, transpose);
00093 
00094   INSTALL_BINOP (op_eq, octave_sparse_bool_matrix,
00095                  octave_sparse_bool_matrix, eq);
00096   INSTALL_BINOP (op_ne, octave_sparse_bool_matrix,
00097                  octave_sparse_bool_matrix, ne);
00098 
00099   INSTALL_BINOP (op_el_and, octave_sparse_bool_matrix,
00100                  octave_sparse_bool_matrix, el_and);
00101   INSTALL_BINOP (op_el_or, octave_sparse_bool_matrix,
00102                  octave_sparse_bool_matrix, el_or);
00103 
00104   INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_bool_matrix,
00105                  sbm_sbm);
00106   INSTALL_CATOP (octave_sparse_bool_matrix, octave_sparse_matrix, sbm_sm);
00107   INSTALL_CATOP (octave_sparse_matrix, octave_sparse_bool_matrix, sm_sbm);
00108 
00109   INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_bool_matrix,
00110                     octave_sparse_bool_matrix, assign);
00111 
00112   INSTALL_CONVOP (octave_sparse_bool_matrix, octave_sparse_matrix,
00113                   bool_matrix_to_double_matrix);
00114 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines