comparison src/OPERATORS/op-sm-scm.cc @ 9931:fb6b6fcafa62

untabify files in src/OPERATORS directory
author John W. Eaton <jwe@octave.org>
date Mon, 07 Dec 2009 14:49:48 -0500
parents a1dbe9d80eee
children ac4b97c6bf8b
comparison
equal deleted inserted replaced
9930:1ddc25c3623a 9931:fb6b6fcafa62
1 /* 1 /*
2 2
3 Copyright (C) 2004, 2005, 2006, 2007 David Bateman 3 Copyright (C) 2004, 2005, 2006, 2007, 2009 David Bateman
4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler 4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler
5 5
6 This file is part of Octave. 6 This file is part of Octave.
7 7
8 Octave is free software; you can redistribute it and/or modify it 8 Octave is free software; you can redistribute it and/or modify it
52 if (v2.rows() == 1 && v2.columns() == 1) 52 if (v2.rows() == 1 && v2.columns() == 1)
53 { 53 {
54 Complex d = v2.complex_value (); 54 Complex d = v2.complex_value ();
55 55
56 if (d == 0.0) 56 if (d == 0.0)
57 gripe_divide_by_zero (); 57 gripe_divide_by_zero ();
58 58
59 return octave_value (v1.sparse_matrix_value () / d); 59 return octave_value (v1.sparse_matrix_value () / d);
60 } 60 }
61 else 61 else
62 { 62 {
63 MatrixType typ = v2.matrix_type (); 63 MatrixType typ = v2.matrix_type ();
64 SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (), 64 SparseComplexMatrix ret = xdiv (v1.sparse_matrix_value (),
65 v2.sparse_complex_matrix_value (), typ); 65 v2.sparse_complex_matrix_value (), typ);
66 66
67 v2.matrix_type (typ); 67 v2.matrix_type (typ);
68 return ret; 68 return ret;
69 } 69 }
70 } 70 }
82 if (v1.rows() == 1 && v1.columns() == 1) 82 if (v1.rows() == 1 && v1.columns() == 1)
83 { 83 {
84 double d = v1.scalar_value (); 84 double d = v1.scalar_value ();
85 85
86 if (d == 0.0) 86 if (d == 0.0)
87 gripe_divide_by_zero (); 87 gripe_divide_by_zero ();
88 88
89 return octave_value (v2.sparse_complex_matrix_value () / d); 89 return octave_value (v2.sparse_complex_matrix_value () / d);
90 } 90 }
91 else 91 else
92 { 92 {
93 MatrixType typ = v1.matrix_type (); 93 MatrixType typ = v1.matrix_type ();
94 94
95 SparseComplexMatrix ret = 95 SparseComplexMatrix ret =
96 xleftdiv (v1.sparse_matrix_value (), 96 xleftdiv (v1.sparse_matrix_value (),
97 v2.sparse_complex_matrix_value (), typ); 97 v2.sparse_complex_matrix_value (), typ);
98 98
99 v1.matrix_type (typ); 99 v1.matrix_type (typ);
100 return ret; 100 return ret;
101 } 101 }
102 } 102 }
113 DEFBINOP_FN (el_pow, sparse_matrix, sparse_complex_matrix, elem_xpow) 113 DEFBINOP_FN (el_pow, sparse_matrix, sparse_complex_matrix, elem_xpow)
114 114
115 DEFBINOP (el_ldiv, sparse_matrix, sparse_complex_matrix) 115 DEFBINOP (el_ldiv, sparse_matrix, sparse_complex_matrix)
116 { 116 {
117 CAST_BINOP_ARGS (const octave_sparse_matrix&, 117 CAST_BINOP_ARGS (const octave_sparse_matrix&,
118 const octave_sparse_complex_matrix&); 118 const octave_sparse_complex_matrix&);
119 119
120 return octave_value 120 return octave_value
121 (quotient (v2.sparse_complex_matrix_value (), v1.sparse_matrix_value ())); 121 (quotient (v2.sparse_complex_matrix_value (), v1.sparse_matrix_value ()));
122 } 122 }
123 123
134 134
135 void 135 void
136 install_sm_scm_ops (void) 136 install_sm_scm_ops (void)
137 { 137 {
138 INSTALL_BINOP (op_add, octave_sparse_matrix, octave_sparse_complex_matrix, 138 INSTALL_BINOP (op_add, octave_sparse_matrix, octave_sparse_complex_matrix,
139 add); 139 add);
140 INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_sparse_complex_matrix, 140 INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_sparse_complex_matrix,
141 sub); 141 sub);
142 INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_sparse_complex_matrix, 142 INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_sparse_complex_matrix,
143 mul); 143 mul);
144 INSTALL_BINOP (op_div, octave_sparse_matrix, octave_sparse_complex_matrix, 144 INSTALL_BINOP (op_div, octave_sparse_matrix, octave_sparse_complex_matrix,
145 div); 145 div);
146 INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_sparse_complex_matrix, 146 INSTALL_BINOP (op_pow, octave_sparse_matrix, octave_sparse_complex_matrix,
147 pow); 147 pow);
148 INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_sparse_complex_matrix, 148 INSTALL_BINOP (op_ldiv, octave_sparse_matrix, octave_sparse_complex_matrix,
149 ldiv); 149 ldiv);
150 INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_complex_matrix, 150 INSTALL_BINOP (op_lt, octave_sparse_matrix, octave_sparse_complex_matrix,
151 lt); 151 lt);
152 INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_complex_matrix, 152 INSTALL_BINOP (op_le, octave_sparse_matrix, octave_sparse_complex_matrix,
153 le); 153 le);
154 INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_complex_matrix, 154 INSTALL_BINOP (op_eq, octave_sparse_matrix, octave_sparse_complex_matrix,
155 eq); 155 eq);
156 INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_complex_matrix, 156 INSTALL_BINOP (op_ge, octave_sparse_matrix, octave_sparse_complex_matrix,
157 ge); 157 ge);
158 INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_complex_matrix, 158 INSTALL_BINOP (op_gt, octave_sparse_matrix, octave_sparse_complex_matrix,
159 gt); 159 gt);
160 INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_complex_matrix, 160 INSTALL_BINOP (op_ne, octave_sparse_matrix, octave_sparse_complex_matrix,
161 ne); 161 ne);
162 INSTALL_BINOP (op_el_mul, octave_sparse_matrix, 162 INSTALL_BINOP (op_el_mul, octave_sparse_matrix,
163 octave_sparse_complex_matrix, el_mul); 163 octave_sparse_complex_matrix, el_mul);
164 INSTALL_BINOP (op_el_div, octave_sparse_matrix, 164 INSTALL_BINOP (op_el_div, octave_sparse_matrix,
165 octave_sparse_complex_matrix, el_div); 165 octave_sparse_complex_matrix, el_div);
166 INSTALL_BINOP (op_el_pow, octave_sparse_matrix, 166 INSTALL_BINOP (op_el_pow, octave_sparse_matrix,
167 octave_sparse_complex_matrix, el_pow); 167 octave_sparse_complex_matrix, el_pow);
168 INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix, 168 INSTALL_BINOP (op_el_ldiv, octave_sparse_matrix,
169 octave_sparse_complex_matrix, el_ldiv); 169 octave_sparse_complex_matrix, el_ldiv);
170 INSTALL_BINOP (op_el_and, octave_sparse_matrix, 170 INSTALL_BINOP (op_el_and, octave_sparse_matrix,
171 octave_sparse_complex_matrix, el_and); 171 octave_sparse_complex_matrix, el_and);
172 INSTALL_BINOP (op_el_or, octave_sparse_matrix, 172 INSTALL_BINOP (op_el_or, octave_sparse_matrix,
173 octave_sparse_complex_matrix, el_or); 173 octave_sparse_complex_matrix, el_or);
174 174
175 INSTALL_CATOP (octave_sparse_matrix, octave_sparse_complex_matrix, sm_scm); 175 INSTALL_CATOP (octave_sparse_matrix, octave_sparse_complex_matrix, sm_scm);
176 176
177 INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_sparse_complex_matrix, 177 INSTALL_ASSIGNCONV (octave_sparse_matrix, octave_sparse_complex_matrix,
178 octave_sparse_complex_matrix); 178 octave_sparse_complex_matrix);
179 179
180 INSTALL_WIDENOP (octave_sparse_matrix, octave_sparse_complex_matrix, 180 INSTALL_WIDENOP (octave_sparse_matrix, octave_sparse_complex_matrix,
181 sparse_complex_matrix_conv); 181 sparse_complex_matrix_conv);
182 } 182 }
183 183
184 /* 184 /*
185 ;;; Local Variables: *** 185 ;;; Local Variables: ***
186 ;;; mode: C++ *** 186 ;;; mode: C++ ***