00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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.h"
00033 #include "ov-bool-mat.h"
00034 #include "ov-scalar.h"
00035 #include "ops.h"
00036
00037 #include "ov-re-sparse.h"
00038 #include "ov-bool-sparse.h"
00039
00040
00041
00042 DEFBINOP_FN (ne, bool, sparse_bool_matrix, mx_el_ne)
00043 DEFBINOP_FN (eq, bool, sparse_bool_matrix, mx_el_eq)
00044
00045 DEFBINOP_FN (el_and, bool, sparse_bool_matrix, mx_el_and)
00046 DEFBINOP_FN (el_or, bool, sparse_bool_matrix, mx_el_or)
00047
00048 DEFCATOP (b_sbm, bool, sparse_bool_matrix)
00049 {
00050 CAST_BINOP_ARGS (octave_bool&, const octave_sparse_bool_matrix&);
00051 SparseBoolMatrix tmp (1, 1, v1.bool_value ());
00052 return octave_value (tmp. concat (v2.sparse_bool_matrix_value (),
00053 ra_idx));
00054 }
00055
00056 DEFCATOP (b_sm, bool, sparse_matrix)
00057 {
00058 CAST_BINOP_ARGS (octave_bool&, const octave_sparse_matrix&);
00059 SparseMatrix tmp (1, 1, v1.scalar_value ());
00060 return octave_value (tmp. concat (v2.sparse_matrix_value (), ra_idx));
00061 }
00062
00063 DEFCATOP (s_sbm, scalar, sparse_bool_matrix)
00064 {
00065 CAST_BINOP_ARGS (octave_scalar&, const octave_sparse_bool_matrix&);
00066 SparseMatrix tmp (1, 1, v1.scalar_value ());
00067 return octave_value(tmp. concat (v2.sparse_matrix_value (), ra_idx));
00068 }
00069
00070 DEFCONV (sparse_bool_matrix_conv, bool, sparse_bool_matrix)
00071 {
00072 CAST_CONV_ARG (const octave_bool&);
00073
00074 return new octave_sparse_bool_matrix
00075 (SparseBoolMatrix (1, 1, v.bool_value ()));
00076 }
00077
00078 void
00079 install_b_sbm_ops (void)
00080 {
00081 INSTALL_BINOP (op_eq, octave_bool, octave_sparse_bool_matrix, eq);
00082 INSTALL_BINOP (op_ne, octave_bool, octave_sparse_bool_matrix, ne);
00083
00084 INSTALL_BINOP (op_el_and, octave_bool, octave_sparse_bool_matrix, el_and);
00085 INSTALL_BINOP (op_el_or, octave_bool, octave_sparse_bool_matrix, el_or);
00086
00087 INSTALL_CATOP (octave_bool, octave_sparse_bool_matrix, b_sbm);
00088 INSTALL_CATOP (octave_bool, octave_sparse_matrix, b_sm);
00089 INSTALL_CATOP (octave_scalar, octave_sparse_bool_matrix, s_sbm);
00090
00091 INSTALL_ASSIGNCONV (octave_bool, octave_sparse_bool_matrix,
00092 octave_bool_matrix);
00093
00094 INSTALL_WIDENOP (octave_bool, octave_sparse_bool_matrix, sparse_bool_matrix_conv);
00095 }