annotate test/sparse-assign.tst @ 31214:19bd1953fc1d stable

GitHub-CI: Remove ubuntu-18.04 runners from build matrix. * .github/workflow/make.yaml (ubuntu): GitHub-hosted runners for ubuntu-18.04 are being deprecated. Remove them from build matrix. See also: https://github.com/actions/runner-images/issues/6002
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 30 Aug 2022 11:16:27 +0200
parents 796f54d4ddbf
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29845
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 ########################################################################
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29845
diff changeset
3 ## Copyright (C) 2021-2022 The Octave Project Developers
29845
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4 ##
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 ##
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 ## This file is part of Octave.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 ##
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 ## (at your option) any later version.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 ##
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 ## GNU General Public License for more details.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 ##
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 ## <https://www.gnu.org/licenses/>.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 ##
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 ########################################################################
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 ## FIXME: will also need tests for if assignment of integer values
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 ## once that is implemented. The pattern can be the same.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 %!shared lr, lc, rr, rc, si, sj, mi, mj, sm_lhs, csm_lhs, s, m, sm, cs, cm, csm
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 %! lr = 6;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 %! lc = 8;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 %! rr = 2;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 %! rc = 3;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 %! si = 2;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 %! sj = 3;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 %! mi = (1:rr)+2;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 %! mj = (1:rc)+3;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 %! sm_lhs = sprand (lr, lc, 0.1);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 %! csm_lhs = sm_lhs + 1i * sprand (lr, lc, 0.1);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 %! s = rand ();
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 %! m = rand (rr, rc);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 %! sm = sprand (rr, rc, 0.1);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 %! cs = s + 1i * rand ();
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 %! cm = m + 1i * rand (rr, rc);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 %! csm = cm + 1i * sprand (rr, rc, 0.1);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 %% Indexed assignment of double scalar, sparse with a single element,
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 %% complex scalar, and sparse complex with a single element to sparse matrix.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 %! rhs = s;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 %! rhs = sparse (s);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 %! rhs = cs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 %! rhs = sparse (cs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94 %% Indexed assignment of double scalar, sparse with a single element,
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 %% complex scalar, and sparse complex with a single element to complex
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 %% sparse matrix.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 %! rhs = s;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 %! rhs = sparse (s);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 %! rhs = cs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133 %! rhs = sparse (cs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
138 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 %% Indexed assignment of matrix, sparse matrix, complex matrix,
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143 %% and complex sparse matrix to sparse matrix.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
147 %! rhs = m;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
149 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
150 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
153 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
158 %! rhs = sm;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
163 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
166
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169 %! rhs = cm;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180 %! rhs = csm;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
182 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
183 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
184 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
188
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
189 %% Indexed assignment of matrix, sparse matrix, complex matrix,
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190 %% and complex sparse matrix to complex sparse matrix.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
192 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
193 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
194 %! rhs = m;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
200 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
201 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
203 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
204 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
205 %! rhs = sm;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
206 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
208 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
213
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
214 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216 %! rhs = cm;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
218 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227 %! rhs = csm;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
235
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
236 %% Indexed assignment of float scalar, float complex scalar, float matrix,
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237 %% and float complex matrix to sparse matrix.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
240 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
241 %! rhs = single (s);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
242 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
243 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
244 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
245 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
248 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
250 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
251 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
252 %! rhs = single (cs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
253 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
254 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
255 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
256 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
257 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
258 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
260
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
262 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
263 %! rhs = single (m);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
264 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
265 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
266 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
267 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
268 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
269 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
270 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
273 %! lhs = sm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
274 %! rhs = single (cm);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
275 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
276 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
277 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
279 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
280 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
282
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
283 %% Indexed assignment of float scalar, float complex scalar, float matrix,
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
284 %% and float complex matrix to complex sparse matrix.
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
285
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
286 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
287 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
288 %! rhs = single (s);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
289 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
290 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
291 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
292 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
293 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
294 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
295 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
296
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
297 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
298 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
299 %! rhs = single (cs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
300 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
301 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
302 %! lhs(si,sj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
303 %! flhs(si,sj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
304 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
305 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
306 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
307
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
308 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
309 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
310 %! rhs = single (m);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
311 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
312 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
313 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
314 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
315 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
316 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
317 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
318
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
319 %!test
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
320 %! lhs = csm_lhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
321 %! rhs = single (cm);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
322 %! flhs = full (lhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
323 %! frhs = full (rhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324 %! lhs(mi,mj) = rhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325 %! flhs(mi,mj) = frhs;
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
326 %! assert (issparse (lhs));
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
327 %! assert (full (lhs), flhs);
2ef9080ca017 allow more mixed-type assignments to work for sparse matrices (bug #60859)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
328 %! assert (iscomplex (lhs), iscomplex (lhs) || iscomplex (rhs));