Hi Charles,

you can extract the row or column of a matrix using viennacl::row() and 
viennacl::column(), e.g.

viennacl::matrix<T> A(N, N);
viennacl::vector<T> x(N);

x = viennacl::row(A, 2);
x = viennacl::column(A, 3);

The assignment of a vector to a matrix row or matrix column is more 
involved, though...

In either case you really want to iterate over elements and use 
per-element access. This is because each access entails a host<->device 
communication, which is very costly with CUDA and OpenCL.

Best regards,
Karli



On 08/17/2015 03:08 PM, Charles Determan wrote:
> I have seen in the documentation that it is simple to access an
> individual element in a viennacl::matrix with
>
> mat(i,j)
>
> but how could I access an entire row or column?  Is there similar syntax
> or would I need to iterate over each element of a row/column?
>
> Thanks,
> Charles
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> ViennaCL-devel mailing list
> ViennaCL-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/viennacl-devel
>


------------------------------------------------------------------------------
_______________________________________________
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel

Reply via email to