comparison src/OPERATORS/op-scm-sm.cc @ 5164:57077d0ddc8e

[project @ 2005-02-25 19:55:24 by jwe]
author jwe
date Fri, 25 Feb 2005 19:55:28 +0000
parents
children 4c8a2e4e0717
comparison
equal deleted inserted replaced
5163:9f3299378193 5164:57077d0ddc8e
1 /*
2
3 Copyright (C) 2004 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
5
6 Octave is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
10
11 Octave is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include "gripes.h"
27 #include "oct-obj.h"
28 #include "ov.h"
29 #include "ov-typeinfo.h"
30 #include "ops.h"
31
32 #include "sparse-xdiv.h"
33 #include "sparse-xpow.h"
34 #include "smx-sm-scm.h"
35 #include "smx-scm-sm.h"
36 #include "ov-re-sparse.h"
37 #include "ov-cx-sparse.h"
38
39 // sparse complex matrix by sparse matrix ops.
40
41 DEFBINOP_OP (add, sparse_complex_matrix, sparse_matrix, +)
42 DEFBINOP_OP (sub, sparse_complex_matrix, sparse_matrix, -)
43
44 DEFBINOP_OP (mul, sparse_complex_matrix, sparse_matrix, *)
45
46 DEFBINOP_FN (div, sparse_complex_matrix, sparse_matrix, xdiv)
47
48 DEFBINOPX (pow, sparse_complex_matrix, sparse_matrix)
49 {
50 error ("can't do A ^ B for A and B both matrices");
51 return octave_value ();
52 }
53
54 DEFBINOP_FN (ldiv, sparse_complex_matrix, sparse_matrix, xleftdiv)
55
56 DEFBINOP_FN (lt, sparse_complex_matrix, sparse_matrix, mx_el_lt)
57 DEFBINOP_FN (le, sparse_complex_matrix, sparse_matrix, mx_el_le)
58 DEFBINOP_FN (eq, sparse_complex_matrix, sparse_matrix, mx_el_eq)
59 DEFBINOP_FN (ge, sparse_complex_matrix, sparse_matrix, mx_el_ge)
60 DEFBINOP_FN (gt, sparse_complex_matrix, sparse_matrix, mx_el_gt)
61 DEFBINOP_FN (ne, sparse_complex_matrix, sparse_matrix, mx_el_ne)
62
63 DEFBINOP_FN (el_mul, sparse_complex_matrix, sparse_matrix, product)
64 DEFBINOP_FN (el_div, sparse_complex_matrix, sparse_matrix, quotient)
65 DEFBINOP_FN (el_pow, sparse_complex_matrix, sparse_matrix, elem_xpow)
66
67 DEFBINOP (el_ldiv, sparse_complex_matrix, sparse_matrix)
68 {
69 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&,
70 const octave_sparse_matrix&);
71
72 return octave_value
73 (quotient (v2.sparse_matrix_value (), v1.sparse_complex_matrix_value ()));
74 }
75
76 DEFBINOP_FN (el_and, sparse_complex_matrix, sparse_matrix, mx_el_and)
77 DEFBINOP_FN (el_or, sparse_complex_matrix, sparse_matrix, mx_el_or)
78
79 DEFCATOP_FN (scm_sm, sparse_complex_matrix, sparse_matrix, concat)
80
81 DEFASSIGNOP_FN (assign, sparse_complex_matrix, sparse_matrix, assign)
82
83 void
84 install_scm_sm_ops (void)
85 {
86 INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_sparse_matrix,
87 add);
88 INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_sparse_matrix,
89 sub);
90 INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_sparse_matrix,
91 mul);
92 INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_sparse_matrix,
93 div);
94 INSTALL_BINOP (op_pow, octave_sparse_complex_matrix, octave_sparse_matrix,
95 pow);
96 INSTALL_BINOP (op_ldiv, octave_sparse_complex_matrix, octave_sparse_matrix,
97 ldiv);
98 INSTALL_BINOP (op_lt, octave_sparse_complex_matrix, octave_sparse_matrix,
99 lt);
100 INSTALL_BINOP (op_le, octave_sparse_complex_matrix, octave_sparse_matrix,
101 le);
102 INSTALL_BINOP (op_eq, octave_sparse_complex_matrix, octave_sparse_matrix,
103 eq);
104 INSTALL_BINOP (op_ge, octave_sparse_complex_matrix, octave_sparse_matrix,
105 ge);
106 INSTALL_BINOP (op_gt, octave_sparse_complex_matrix, octave_sparse_matrix,
107 gt);
108 INSTALL_BINOP (op_ne, octave_sparse_complex_matrix, octave_sparse_matrix,
109 ne);
110 INSTALL_BINOP (op_el_mul, octave_sparse_complex_matrix,
111 octave_sparse_matrix, el_mul);
112 INSTALL_BINOP (op_el_div, octave_sparse_complex_matrix,
113 octave_sparse_matrix, el_div);
114 INSTALL_BINOP (op_el_pow, octave_sparse_complex_matrix,
115 octave_sparse_matrix, el_pow);
116 INSTALL_BINOP (op_el_ldiv, octave_sparse_complex_matrix,
117 octave_sparse_matrix, el_ldiv);
118 INSTALL_BINOP (op_el_and, octave_sparse_complex_matrix,
119 octave_sparse_matrix, el_and);
120 INSTALL_BINOP (op_el_or, octave_sparse_complex_matrix,
121 octave_sparse_matrix, el_or);
122
123 INSTALL_CATOP (octave_sparse_complex_matrix, octave_sparse_matrix, scm_sm);
124
125 INSTALL_ASSIGNOP (op_asn_eq, octave_sparse_complex_matrix,
126 octave_sparse_matrix, assign);
127 }
128
129 /*
130 ;;; Local Variables: ***
131 ;;; mode: C++ ***
132 ;;; End: ***
133 */