From: Karl R. <ru...@iu...> - 2013-05-15 15:56:48
|
Hi Kirell, if you're using OpenCL, there's a way for promoting a vector to a matrix as follows: vector<double> x = prod(A, y); // this is your SpMV operation // create the proxy object. Adjust num_cols, num_rows is probably 1 matrix<double> x2(x.handle().opencl_handle(), num_rows, num_cols); your_range += x2; //here you add to your subrange This currently doesn't work with CUDA or the OpenMP backends, though. Best regards, Karli On 05/15/2013 10:48 AM, Kirell Benzi wrote: > Hi, > In append I mean setting the entries. > > something like this: > > matrix.at(row) += myVector; > > I have tried to create the vector as a matrix, but this vector is the result of of compressed_matrix * vector. The sparse matrix * matrix is not implemented is viennacl, so I need to transform my vector in a matrix. > > The other solution would be to have a std::vector< viennacl:::vector> > instead of a matrix. But it will be slow since for each operation I would have to switch back and forth with the cpu_ram. > > Do you have any advices ? > > ++ > > ---------------------------------------------------------------------- > > Kirell Benzi > PhD student, Research assistant, > Laboratoire de traitement des signaux 2 > Institute of Electrical Engineering - IEL > Ecole Polytechnique Fédérale de Lausanne - EPFL > EPFL/STI/IEL/LTS2 > ELE 229 (Bâtiment ELE) > Station 11 > CH-1015 Lausanne > Switzerland > Home page: http://people.epfl.ch/kirell.benzi > Lab page: http://lts2.epfl.ch > Tel: +41 21 69 37895 > ---------------------------------------------------------------------- > > On 15 mai 2013, at 17:40, Karl Rupp <ru...@iu...> > wrote: > >> Hi Kirell, >> >>> I'm new to viennacl. >>> I want to add a row vector to a specific row of in matrix. >>> I have created a matrix_range in a for loop to specify the row I want. >>> Unfortunately, I cannot append a vector to a matrix range. >>> >>> I have tried to transform my vector to a matrix, but it seems impossible. >> >> what exactly do you mean by 'append'? Should a NxN-matrix become a (N+1)xN-matrix, or do you just want to set the entries? >> >> In the former case, you need to resize() the matrix and refill it. In the latter case you currently need to create the 'vector' as a 1xN or 1xM-matrix and then assign to the matrix-range. We don't yet have the generic row() and column() functions ready to directly assign vectors to a matrix row/column. >> >> Best regards, >> Karli > > |