comparison test/test_diag_perm.m @ 8951:5bce1357edd6

Fix conversion from PermMatrix to SparseMatrix. From 76c98628f1943d583d5813321ec0a3c684d7ac84 Mon Sep 17 00:00:00 2001 Date: Tue, 10 Mar 2009 14:12:59 -0400 The result was transposed and missing its values. Also add a test case. Signed-off-by: Jason Riedy <jason@acm.org> --- liboctave/ChangeLog | 6 ++++++ liboctave/dSparse.cc | 7 +++++-- test/ChangeLog | 4 ++++ test/test_diag_perm.m | 9 +++++++++ 4 files changed, 24 insertions(+), 2 deletions(-)
author Jason Riedy <jason@acm.org>
date Tue, 10 Mar 2009 15:44:11 -0400
parents 42e24f4ebc8c
children 43aec7c168eb
comparison
equal deleted inserted replaced
8950:d865363208d6 8951:5bce1357edd6
66 %! Pr = eye (n) (pr, :); 66 %! Pr = eye (n) (pr, :);
67 %! A = rand (n); 67 %! A = rand (n);
68 %! A(n, n-2) = NaN; 68 %! A(n, n-2) = NaN;
69 %! A(3, 1) = Inf; 69 %! A(3, 1) = Inf;
70 %! assert (Pr * A * Pc, A(pr, pc)); 70 %! assert (Pr * A * Pc, A(pr, pc));
71
72 ## conversion to sparse form
73 %!test
74 %! n = 7;
75 %! P = eye (n) (:, randperm (n));
76 %! sP = sparse (P);
77 %! assert (full (sP), full (P));
78 %! assert (size (find (sP), 1), n);
71 79
72 ######################################## 80 ########################################
73 ## Diagonal matrices 81 ## Diagonal matrices
74 82
75 ## square row scaling 83 ## square row scaling