MTL: diag_matrix bug

View: New views
1 Messages — Rating Filter:   Alert me  

MTL: diag_matrix bug

by Aaron Scamehorn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
 
I think I've found a bug when multiplying a diagonal Matrix times a Vector.
 
It appears that mult_generic__ was being called, picking up the banded_tag in the diagonal matrix. 
 
Attached is a test program which produces the following output:

V=
[6,7,8,9,10,]
Diag A=
5x5
[
[1,0,0,0,0],
[0,2,0,0,0],
[0,0,3,0,0],
[0,0,0,4,0],
[0,0,0,0,5]
]
Full B=
5x5
[
[1,0,0,0,0],
[0,2,0,0,0],
[0,0,3,0,0],
[0,0,0,4,0],
[0,0,0,0,5]
]
Output AxV=
[6,12,18,24,30,]
Output BxV=
[6,14,24,36,50,]
 
Also attached is a patch that adds a diag_mult__ method to mtl.h.  I have to admit: templates as well as matrices are a little out of my league, but the patch solved my problem!

Great work on the project!  Hope this helps.
 
Thanks,
Aaron 



_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/

mtl_bug.cpp (1K) Download Attachment
mtl_diag.patch (1K) Download Attachment