Hi, Could you please help me with creating CSR matrix. I have only one processor so It have to be done locally Here is the matrix from those information I would like to have matrix petsc matrix. double vals [] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0} ; int c_idx [] = {1, 3, 2, 0, 1, 2, 2, 3} ; int r_idx [] = {0, 2, 3, 6, 8} ; int n_rows = 4 ; //square matrix Thank you in advance for help. Kuba
MatCreateSeqAIJWithArrays() On Dec 12, 2010, at 2:14 PM, Jakub Pola wrote:
Hi,
Could you please help me with creating CSR matrix. I have only one processor so It have to be done locally
Here is the matrix from those information I would like to have matrix petsc matrix.
double vals [] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0} ; int c_idx [] = {1, 3, 2, 0, 1, 2, 2, 3} ; int r_idx [] = {0, 2, 3, 6, 8} ; int n_rows = 4 ; //square matrix
Thank you in advance for help. Kuba
Thanks, Is there also so easy way to extract those arrays from already created matrix? I created matrix A with function: MatCreateSeqAIJWithArrays(PETSC_COMM_SELF, n_rows, n_rows, r_idx, c_idx, vals, A); Now I would like to extract all tables from matrix A; Dnia 2010-12-12, nie o godzinie 14:30 -0600, Barry Smith pisze:
MatCreateSeqAIJWithArrays
On Dec 12, 2010, at 2:41 PM, Jakub Pola wrote:
Thanks,
Is there also so easy way to extract those arrays from already created matrix?
Not particularly because we do not like the idea of directly manipulating the storage details of a particular sparse matrix type. But you can use MatGetRowIJ()/MatRestoreRowIJ() and MatGetArray() if you really want to.
I created matrix A with function: MatCreateSeqAIJWithArrays(PETSC_COMM_SELF, n_rows, n_rows, r_idx, c_idx, vals, A);
Now I would like to extract all tables from matrix A;
What is a "table" of a matrix A? Barry
Dnia 2010-12-12, nie o godzinie 14:30 -0600, Barry Smith pisze:
MatCreateSeqAIJWithArrays
The reason I want to perform this operation is that I have CG solver based on GPU. It takes arguments in the way I have written so double vals [] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0} ; int c_idx [] = {1, 3, 2, 0, 1, 2, 2, 3} ; int r_idx [] = {0, 2, 3, 6, 8} ; int n_rows = 4 ; //square matrix That will help me a lot with testing. I can load matrix using PETSC then I would like to extract this matrix to those arrays. Dnia 2010-12-12, nie o godzinie 14:58 -0600, Barry Smith pisze:
On Dec 12, 2010, at 2:41 PM, Jakub Pola wrote:
Thanks,
Is there also so easy way to extract those arrays from already created matrix?
Not particularly because we do not like the idea of directly manipulating the storage details of a particular sparse matrix type. But you can use MatGetRowIJ()/MatRestoreRowIJ() and MatGetArray() if you really want to.
I created matrix A with function: MatCreateSeqAIJWithArrays(PETSC_COMM_SELF, n_rows, n_rows, r_idx, c_idx, vals, A);
Now I would like to extract all tables from matrix A;
What is a "table" of a matrix A?
Barry
Dnia 2010-12-12, nie o godzinie 14:30 -0600, Barry Smith pisze:
MatCreateSeqAIJWithArrays
participants (2)
-
Barry Smith -
Jakub Pola