From: Karl R. <ru...@iu...> - 2012-07-24 13:51:04
|
Hi Omar, we are currently working on porting the convenience layer from ublas such that rows and/or columns of a dense matrix can be directly manipulated like a vector. You can use matrix_range<> and project() in the meanwhile for submatrix manipulation as a workaround: matrix<double> A(size, 3); range all_rows(0, size); range col_0(0, 1); matrix<double> C = viennacl::linalg::prod( trans(project(A, all_rows, col_0)), project(A, all_rows, col_0) ); std::cout << "Squared norm of first column of A: " << C(0,0) << std::endl; This approach won't give you the best performance, though... Best regards, Karli On 07/23/2012 04:11 PM, Omar Valerio wrote: > Hi list, > > I'm trying to figure out how to use ViennaCL in my project. My project > use Eigen and now I want to get some extra performance. My program used > an STL vector of Eigen Vector3d. > > I thought about using a vector of a non scalar type (a vector of > vectors). I realized ViennaCL such an approach is not convenient for > parallelization and now I am packaging the vectors into a matrix. This > works for me for example to perform vector substraction but I am > concerned about other vector operations I have in my code. > > In Eigen there is a row wise operator that allow me to affect individual > rows within the matrix, I want to ask if there is such a thing also in > ViennaCL.. My use case is very simple. I have a matrix composed of > vector positions organized in rows/colums. I want to be able to > compute squared norms for those vectors.. In Eigen I will do this as > follows: > > vectorSqNorm = Matrix.cwise().abs2(); // abs2 is square of the > absolute value > > Thanks, > -- > Omar V.M. > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > > > _______________________________________________ > ViennaCL-support mailing list > Vie...@li... > https://lists.sourceforge.net/lists/listinfo/viennacl-support > |