annotate src/OPERATORS/op-dm-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 b4fdfee405b5
children fd0a3ac60b0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
1 /*
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
2
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
3 Copyright (C) 2009 Jason Riedy, Jaroslav Hajek
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
4
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
5 This file is part of Octave.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
6
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
10 option) any later version.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
11
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
15 for more details.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
16
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
20
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
21 */
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
22
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
24 #include <config.h>
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
25 #endif
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
26
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
27 #include "gripes.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
28 #include "oct-obj.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
29 #include "ov.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
30 #include "ov-typeinfo.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
31 #include "ops.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
32
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
33 #include "ov-re-diag.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
34 #include "ov-cx-diag.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
35 #include "ov-re-sparse.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
36 #include "ov-cx-sparse.h"
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
37
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
38 #include "sparse-xdiv.h"
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
39
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
40 // diagonal matrix by sparse matrix ops
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
41
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
42 DEFBINOP (mul_dm_scm, diag_matrix, sparse_complex_matrix)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
43 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
44 CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
45
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
46 if (v2.rows() == 1 && v2.columns() == 1)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
47 // If v2 is a scalar in disguise, return a diagonal matrix rather than
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
48 // a sparse matrix.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
49 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
50 std::complex<double> d = v2.complex_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
51
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
52 return octave_value (v1.diag_matrix_value () * d);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
53 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
54 else
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
55 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
56 MatrixType typ = v2.matrix_type ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
57 SparseComplexMatrix ret = v1.diag_matrix_value () * v2.sparse_complex_matrix_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
58 octave_value out = octave_value (ret);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
59 typ.mark_as_unsymmetric ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
60 out.matrix_type (typ);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
61 return out;
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
62 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
63 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
64
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
65 DEFBINOP (mul_cdm_sm, complex_diag_matrix, sparse_matrix)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
66 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
67 CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
68
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
69 if (v2.rows() == 1 && v2.columns() == 1)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
70 // If v2 is a scalar in disguise, return a diagonal matrix rather than
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
71 // a sparse matrix.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
72 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
73 std::complex<double> d = v2.scalar_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
74
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
75 return octave_value (v1.complex_diag_matrix_value () * d);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
76 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
77 else
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
78 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
79 MatrixType typ = v2.matrix_type ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
80 SparseComplexMatrix ret = v1.complex_diag_matrix_value () * v2.sparse_matrix_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
81 octave_value out = octave_value (ret);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
82 typ.mark_as_unsymmetric ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
83 out.matrix_type (typ);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
84 return out;
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
85 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
86 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
87
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
88 DEFBINOP (mul_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
89 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
90 CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
91
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
92 if (v2.rows() == 1 && v2.columns() == 1)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
93 // If v2 is a scalar in disguise, return a diagonal matrix rather than
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
94 // a sparse matrix.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
95 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
96 std::complex<double> d = v2.complex_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
97
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
98 return octave_value (v1.complex_diag_matrix_value () * d);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
99 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
100 else
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
101 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
102 MatrixType typ = v2.matrix_type ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
103 SparseComplexMatrix ret = v1.complex_diag_matrix_value () * v2.sparse_complex_matrix_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
104 octave_value out = octave_value (ret);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
105 typ.mark_as_unsymmetric ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
106 out.matrix_type (typ);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
107 return out;
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
108 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
109 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
110
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
111 DEFBINOP (ldiv_dm_scm, diag_matrix, sparse_complex_matrix)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
112 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
113 CAST_BINOP_ARGS (const octave_diag_matrix&,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
114 const octave_sparse_complex_matrix&);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
115
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
116 MatrixType typ = v2.matrix_type ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
117 return xleftdiv (v1.diag_matrix_value (), v2.sparse_complex_matrix_value (),
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
118 typ);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
119 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
120
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
121 DEFBINOP (ldiv_cdm_sm, complex_diag_matrix, sparse_matrix)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
122 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
123 CAST_BINOP_ARGS (const octave_complex_diag_matrix&,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
124 const octave_sparse_matrix&);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
125
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
126 MatrixType typ = v2.matrix_type ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
127 return xleftdiv (v1.complex_diag_matrix_value (), v2.sparse_matrix_value (),
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
128 typ);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
129 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
130
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
131 DEFBINOP (ldiv_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
132 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
133 CAST_BINOP_ARGS (const octave_complex_diag_matrix&,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
134 const octave_sparse_complex_matrix&);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
135
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
136 MatrixType typ = v2.matrix_type ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
137 return xleftdiv (v1.complex_diag_matrix_value (), v2.sparse_complex_matrix_value (),
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
138 typ);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
139 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
140
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
141 DEFBINOP (add_dm_scm, diag_matrix, sparse_complex_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
142 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
143 CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
144
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
145 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
146 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
147 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
148 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
149 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
150
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8966
diff changeset
151 return octave_value (v1.matrix_value () + d);
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
152 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
153 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
154 return v1.diag_matrix_value () + v2.sparse_complex_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
155 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
156
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
157 DEFBINOP (add_cdm_sm, complex_diag_matrix, sparse_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
158 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
159 CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
160
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
161 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
162 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
163 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
164 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
165 double d = v2.scalar_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
166
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8966
diff changeset
167 return octave_value (v1.complex_matrix_value () + d);
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
168 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
169 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
170 return v1.complex_diag_matrix_value () + v2.sparse_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
171 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
172
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
173 DEFBINOP (add_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
174 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
175 CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
176
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
177 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
178 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
179 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
180 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
181 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
182
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8966
diff changeset
183 return octave_value (v1.complex_matrix_value () + d);
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
184 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
185 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
186 return v1.complex_diag_matrix_value () + v2.sparse_complex_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
187 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
188
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
189 DEFBINOP (sub_dm_scm, diag_matrix, sparse_complex_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
190 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
191 CAST_BINOP_ARGS (const octave_diag_matrix&, const octave_sparse_complex_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
192
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
193 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
194 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
195 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
196 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
197 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
198
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8966
diff changeset
199 return octave_value (v1.matrix_value () + (-d));
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
200 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
201 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
202 return v1.diag_matrix_value () - v2.sparse_complex_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
203 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
204
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
205 DEFBINOP (sub_cdm_sm, complex_diag_matrix, sparse_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
206 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
207 CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
208
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
209 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
210 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
211 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
212 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
213 double d = v2.scalar_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
214
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8966
diff changeset
215 return octave_value (v1.complex_matrix_value () + (-d));
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
216 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
217 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
218 return v1.complex_diag_matrix_value () - v2.sparse_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
219 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
220
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
221 DEFBINOP (sub_cdm_scm, complex_diag_matrix, sparse_complex_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
222 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
223 CAST_BINOP_ARGS (const octave_complex_diag_matrix&, const octave_sparse_complex_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
224
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
225 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
226 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
227 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
228 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
229 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
230
9732
b4fdfee405b5 remove ArrayN<T> + fix nonhom. diag-scalar ops
Jaroslav Hajek <highegg@gmail.com>
parents: 8966
diff changeset
231 return octave_value (v1.complex_matrix_value () + (-d));
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
232 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
233 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
234 return v1.complex_diag_matrix_value () - v2.sparse_complex_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
235 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
236
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
237 // sparse matrix by diagonal matrix ops
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
238
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
239 DEFBINOP (mul_scm_dm, sparse_complex_matrix, diag_matrix)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
240 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
241 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
242
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
243 if (v1.rows() == 1 && v1.columns() == 1)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
244 // If v1 is a scalar in disguise, return a diagonal matrix rather than
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
245 // a sparse matrix.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
246 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
247 std::complex<double> d = v1.complex_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
248
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
249 return octave_value (d * v2.diag_matrix_value ());
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
250 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
251 else
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
252 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
253 MatrixType typ = v1.matrix_type ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
254 SparseComplexMatrix ret = v1.sparse_complex_matrix_value () * v2.diag_matrix_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
255 octave_value out = octave_value (ret);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
256 typ.mark_as_unsymmetric ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
257 out.matrix_type (typ);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
258 return out;
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
259 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
260 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
261
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
262 DEFBINOP (mul_sm_cdm, sparse_matrix, complex_diag_matrix)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
263 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
264 CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
265
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
266 if (v1.rows() == 1 && v1.columns() == 1)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
267 // If v1 is a scalar in disguise, return a diagonal matrix rather than
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
268 // a sparse matrix.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
269 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
270 std::complex<double> d = v1.complex_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
271
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
272 return octave_value (d * v2.complex_diag_matrix_value ());
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
273 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
274 else
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
275 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
276 MatrixType typ = v1.matrix_type ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
277 SparseComplexMatrix ret = v1.sparse_matrix_value () * v2.complex_diag_matrix_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
278 octave_value out = octave_value (ret);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
279 typ.mark_as_unsymmetric ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
280 out.matrix_type (typ);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
281 return out;
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
282 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
283 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
284
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
285 DEFBINOP (mul_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
286 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
287 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
288
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
289 if (v1.rows() == 1 && v1.columns() == 1)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
290 // If v1 is a scalar in disguise, return a diagonal matrix rather than
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
291 // a sparse matrix.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
292 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
293 std::complex<double> d = v1.complex_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
294
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
295 return octave_value (d * v2.complex_diag_matrix_value ());
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
296 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
297 else if (v2.rows() == 1 && v2.columns() == 1)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
298 // If v2 is a scalar in disguise, don't bother with further dispatching.
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
299 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
300 std::complex<double> d = v2.complex_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
301
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
302 return octave_value (v1.sparse_complex_matrix_value () * d);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
303 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
304 else
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
305 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
306 MatrixType typ = v1.matrix_type ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
307 SparseComplexMatrix ret = v1.sparse_complex_matrix_value () * v2.complex_diag_matrix_value ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
308 octave_value out = octave_value (ret);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
309 typ.mark_as_unsymmetric ();
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
310 out.matrix_type (typ);
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
311 return out;
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
312 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
313 }
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
314
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
315 DEFBINOP (div_scm_dm, sparse_complex_matrix, diag_matrix)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
316 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
317 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
318
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
319 if (v2.rows() == 1 && v2.columns() == 1)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
320 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
321 double d = v2.scalar_value ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
322
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
323 if (d == 0.0)
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
324 gripe_divide_by_zero ();
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
325
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
326 return octave_value (v1.sparse_complex_matrix_value () / d);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
327 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
328 else
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
329 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
330 MatrixType typ = v2.matrix_type ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
331 return xdiv (v1.sparse_complex_matrix_value (), v2.diag_matrix_value (), typ);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
332 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
333 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
334
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
335 DEFBINOP (div_sm_cdm, sparse_matrix, complex_diag_matrix)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
336 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
337 CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
338
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
339 if (v2.rows() == 1 && v2.columns() == 1)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
340 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
341 std::complex<double> d = v2.complex_value ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
342
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
343 if (d == 0.0)
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
344 gripe_divide_by_zero ();
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
345
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
346 return octave_value (v1.sparse_matrix_value () / d);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
347 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
348 else
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
349 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
350 MatrixType typ = v2.matrix_type ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
351 return xdiv (v1.sparse_matrix_value (), v2.complex_diag_matrix_value (), typ);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
352 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
353 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
354
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
355 DEFBINOP (div_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
356 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
357 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
358
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
359 if (v2.rows() == 1 && v2.columns() == 1)
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
360 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
361 std::complex<double> d = v2.complex_value ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
362
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
363 if (d == 0.0)
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
364 gripe_divide_by_zero ();
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
365
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
366 return octave_value (v1.sparse_complex_matrix_value () / d);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
367 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
368 else
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
369 {
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
370 MatrixType typ = v2.matrix_type ();
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
371 return xdiv (v1.sparse_complex_matrix_value (), v2.complex_diag_matrix_value (), typ);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
372 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
373 }
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
374
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
375 DEFBINOP (add_sm_cdm, sparse_matrix, complex_diag_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
376 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
377 CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
378
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
379 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
380 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
381 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
382 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
383 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
384
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
385 return octave_value (v1.sparse_matrix_value () + d);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
386 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
387 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
388 return v1.sparse_matrix_value () + v2.complex_diag_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
389 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
390
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
391 DEFBINOP (add_scm_dm, sparse_complex_matrix, diag_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
392 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
393 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
394
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
395 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
396 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
397 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
398 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
399 double d = v2.scalar_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
400
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
401 return octave_value (v1.sparse_complex_matrix_value () + d);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
402 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
403 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
404 return v1.sparse_complex_matrix_value () + v2.diag_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
405 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
406
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
407 DEFBINOP (add_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
408 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
409 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
410
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
411 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
412 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
413 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
414 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
415 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
416
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
417 return octave_value (v1.sparse_complex_matrix_value () + d);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
418 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
419 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
420 return v1.sparse_complex_matrix_value () + v2.complex_diag_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
421 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
422
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
423 DEFBINOP (sub_sm_cdm, sparse_matrix, complex_diag_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
424 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
425 CAST_BINOP_ARGS (const octave_sparse_matrix&, const octave_complex_diag_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
426
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
427 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
428 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
429 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
430 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
431 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
432
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
433 return octave_value (v1.sparse_matrix_value () + (-d));
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
434 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
435 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
436 return v1.sparse_matrix_value () - v2.complex_diag_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
437 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
438
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
439 DEFBINOP (sub_scm_dm, sparse_complex_matrix, diag_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
440 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
441 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_diag_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
442
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
443 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
444 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
445 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
446 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
447 double d = v2.scalar_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
448
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
449 return octave_value (v1.sparse_complex_matrix_value () + (-d));
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
450 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
451 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
452 return v1.sparse_complex_matrix_value () - v2.diag_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
453 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
454
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
455 DEFBINOP (sub_scm_cdm, sparse_complex_matrix, complex_diag_matrix)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
456 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
457 CAST_BINOP_ARGS (const octave_sparse_complex_matrix&, const octave_complex_diag_matrix&);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
458
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
459 if (v2.rows() == 1 && v2.columns() == 1)
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
460 // If v2 is a scalar in disguise, return a diagonal matrix rather than
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
461 // a sparse matrix.
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
462 {
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
463 std::complex<double> d = v2.complex_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
464
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
465 return octave_value (v1.sparse_complex_matrix_value () + (-d));
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
466 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
467 else
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
468 return v1.sparse_complex_matrix_value () - v2.complex_diag_matrix_value ();
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
469 }
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
470
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
471 void
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
472 install_dm_scm_ops (void)
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
473 {
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
474 INSTALL_BINOP (op_mul, octave_diag_matrix, octave_sparse_complex_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
475 mul_dm_scm);
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
476 INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_sparse_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
477 mul_cdm_sm);
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
478 INSTALL_BINOP (op_mul, octave_complex_diag_matrix, octave_sparse_complex_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
479 mul_cdm_scm);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
480 INSTALL_BINOP (op_ldiv, octave_diag_matrix, octave_sparse_complex_matrix, ldiv_dm_scm);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
481 INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_sparse_matrix, ldiv_cdm_sm);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
482 INSTALL_BINOP (op_ldiv, octave_complex_diag_matrix, octave_sparse_complex_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
483 ldiv_cdm_scm);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
484
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
485 INSTALL_BINOP (op_add, octave_diag_matrix, octave_sparse_complex_matrix, add_dm_scm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
486 INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_sparse_matrix, add_cdm_sm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
487 INSTALL_BINOP (op_add, octave_complex_diag_matrix, octave_sparse_complex_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
488 add_cdm_scm);
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
489 INSTALL_BINOP (op_sub, octave_diag_matrix, octave_sparse_complex_matrix, sub_dm_scm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
490 INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_sparse_matrix, sub_cdm_sm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
491 INSTALL_BINOP (op_sub, octave_complex_diag_matrix, octave_sparse_complex_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
492 sub_cdm_scm);
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
493
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
494 INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_diag_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
495 mul_scm_dm);
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
496 INSTALL_BINOP (op_mul, octave_sparse_matrix, octave_complex_diag_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
497 mul_sm_cdm);
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
498 INSTALL_BINOP (op_mul, octave_sparse_complex_matrix, octave_complex_diag_matrix,
9931
fb6b6fcafa62 untabify files in src/OPERATORS directory
John W. Eaton <jwe@octave.org>
parents: 9732
diff changeset
499 mul_scm_cdm);
8965
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
500
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
501 INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_diag_matrix, div_scm_dm);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
502 INSTALL_BINOP (op_div, octave_sparse_matrix, octave_complex_diag_matrix, div_sm_cdm);
42aff15e059b Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents: 8964
diff changeset
503 INSTALL_BINOP (op_div, octave_sparse_complex_matrix, octave_complex_diag_matrix, div_scm_cdm);
8966
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
504
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
505 INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_diag_matrix, add_scm_dm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
506 INSTALL_BINOP (op_add, octave_sparse_matrix, octave_complex_diag_matrix, add_sm_cdm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
507 INSTALL_BINOP (op_add, octave_sparse_complex_matrix, octave_complex_diag_matrix, add_scm_cdm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
508 INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_diag_matrix, sub_scm_dm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
509 INSTALL_BINOP (op_sub, octave_sparse_matrix, octave_complex_diag_matrix, sub_sm_cdm);
1bba53c0a38d Implement diag + sparse, diag - sparse, sparse + diag, sparse - diag.
Jason Riedy <jason@acm.org>
parents: 8965
diff changeset
510 INSTALL_BINOP (op_sub, octave_sparse_complex_matrix, octave_complex_diag_matrix, sub_scm_cdm);
8964
f4f4d65faaa0 Implement sparse * diagonal and diagonal * sparse operations, double-prec only.
Jason Riedy <jason@acm.org>
parents:
diff changeset
511 }