Hi Toby, > I'm currently trying to implement matrix and vector proxies in > PyViennaCL, and I can't get my matrices to look right. Suppose I have > the following arbitrary 5x5 matrix, as displayed in Python: > >>>> m.value > array([[ 1., 2., 3., 4., 0.], > [ 5., 6., 7., 0., 8.], > [ 9., 10., 0., 11., 12.], > [ 13., 0., 14., 15., 16.], > [ 0., 17., 18., 19., 20.]]) > > And I want to extract the following arbitrary slices (indices from 0): > >>>> m.value[1:4:2,1:4:2] > array([[ 6., 0.], > [ 0., 15.]]) > > This works fine, because I'm using NumPy's array slicing. But suppose I > use the ViennaCL slice/proxy interface: > >>>> m[1:4:2,1:4:2].value > start: 1, 1 > stride: 2, 2 > size: 2, 2 > array([[ 1., 2.], > [ 3., 4.]]) > > (The 'start', 'stride', and 'size' lines are debug output I put in > matrix_proxy.hpp). This clearly isn't right, and yet my slice objects > seem to be constructed correctly!
How do you construct these objects? All the proxies are tested in the matrix-*-test suite as well as the blas3_prod and blas3_solve tests, where they produce correct results. > I dug around in the matrix_proxy.hpp and vector_proxy.hpp files, and I > came across a couple of apparent inconsistencies. I patched those (see > below), but I don't know if my patch is right or wrong, since I'm not > creating proxies of proxies, and thus the behaviour hasn't changed. I > don't really know where to dig next to unearth the root of this > behaviour: whether it's a bug in my code, or in ViennaCL.. There are only a few tests for proxies of proxies, so there may be indeed some things broken. > Oh, and the vector code seems to work fine, even though it's called in > almost exactly the same way as the matrix code! > > Can you help? :) Sure. Could you please derive some simple test case from examples/tutorial/matrix-range.cpp with slices in order to find the cause of the issue? You should be able to implement the submatrix proxy described above in a straight-forward manner *and* get correct results :-) Best regards, Karli ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ ViennaCL-devel mailing list ViennaCL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viennacl-devel