sparse matrix comparaison

43 views
Skip to first unread message

Ghada YACOUBI

unread,
Apr 17, 2012, 2:29:27 PM4/17/12
to tumbi
Hello
How could we compare 2 sparse matrixes?? for example I have A and b
sparse matrixes, when I enter if A==b, I have this message:

Error: a specialized function eq_sp_sp is missing
==>(A==b)

I couldn't find this function.
Thanks

bruno

unread,
Apr 17, 2012, 2:56:51 PM4/17/12
to tu...@googlegroups.com


Le mardi 17 avril 2012 20:29:27 UTC+2, Ghada YACOUBI a écrit :
Hello
How could we compare 2 sparse matrixes?? for example I have A and b
sparse matrixes, when I enter if A==b, I have this message:

Error: a specialized function eq_sp_sp is missing
        ==>(A==b)



     Hello,

  you have to use:

   A.equal[B]

  hth
Bruno
 

omar

unread,
Apr 17, 2012, 3:23:33 PM4/17/12
to tu...@googlegroups.com


thx it is working (we tried before A.equal(B)) but we expected it to do the comparison element by element (like when we use '==' for full matrix)  

bruno

unread,
Apr 18, 2012, 12:25:20 PM4/18/12
to tu...@googlegroups.com


Le mardi 17 avril 2012 21:23:33 UTC+2, omar a écrit :


thx it is working (we tried before A.equal(B)) but we expected it to do the comparison element by element (like when we use '==' for full matrix)  


  In fact boolean sparse matrices are not yet implemented. Depending on
 what you want to do exactly there are possible workarounds, one can be
 to use:

   [ii,jj] = find(A - B);

  and this will give you the (row,column) indices (ii(k), jj(k)) where the
 coefficients are not the same.

  hth
Bruno
Reply all
Reply to author
Forward
0 new messages