[petsc-users] Get and Set the k-th diagonal elements

2011-05-06 Thread Barry Smith
Are the diagonals constant values, or does each row have a separate value? Barry On May 6, 2011, at 4:23 PM, Xiangdong Liang wrote: > Thanks for your response, Barry. I am going to solve A_n x = b for > different A_n's. The difference between A_n's are only the main > diagonal and the k-t

[petsc-users] Erro in solution

2011-05-06 Thread Danesh Daroui
Dear PETSc users, I have recently started to use PETSc in our code. As the first try, I assemble the matrix row by row and then put each non-zero element in each row into PETSc matrix. Then I start to solve the equation. I use PETSc on a multi-core machine, so I will not use MPI in my program. I

[petsc-users] PetscSortRealWithPermutation causes segfaults

2011-05-06 Thread Jed Brown
ntees log-linear complexity and no dynamic memory allocation. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110506/4f7a6935/attachment.htm>

[petsc-users] Get and Set the k-th diagonal elements

2011-05-06 Thread Xiangdong Liang
Thanks for your response, Barry. I am going to solve A_n x = b for different A_n's. The difference between A_n's are only the main diagonal and the k-th diagonal. I want to generate the matrix A once, and each time modify the main and k-th diagonals to get a new A_n. That's the reason I am asking

[petsc-users] Get and Set the k-th diagonal elements

2011-05-06 Thread Xiangdong Liang
Hello everyone, I am wondering whether there is some function like MatGetDiagonal to get the k-th diagonal (above or below the main diagonal) of the matrix A. If I have to write my own function, what built-in function should I use to get a particular element of A? It seems that MatGetValues return

[petsc-users] Get and Set the k-th diagonal elements

2011-05-06 Thread Barry Smith
How are you planning to use these diagonals? This might help us make suggestions as to what is a reasonable approach. Accessing diagonals is not a natural operation for sparse matrices stored by rows or columns. Barry On May 6, 2011, at 3:56 PM, Xiangdong Liang wrote: > Hello everyone,

[petsc-users] Erro in solution

2011-05-06 Thread Barry Smith
Danesh, Some of the PETSc solvers (like the default ILU) require that you put entries on all the diagonal locations of the matrix, even if they are zero. So you should explicitly put a 0 on the diagonal locations that have 0 and the issue will go away. Barry On May 6, 2011, at 1:1

[petsc-users] PetscSortRealWithPermutation causes segfaults

2011-05-06 Thread S V N Vishwanathan
> This issue of hitting worst case of quicksort came up before with > PetscSortInt. It would be interesting to know if the pivot selection > in PetscSortInt_Private would fix the worst-case behavior that you > see? If so, then the same changes could be made to the other sorting > routines. I did

[petsc-users] PetscSortRealWithPermutation causes segfaults

2011-05-06 Thread Jed Brown
-- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110506/3bc5c7cf/attachment.htm>

[petsc-users] PetscSortRealWithPermutation causes segfaults

2011-05-06 Thread S V N Vishwanathan
Hi I am using PetscSortRealWithPermutation to sort an array with around 200K elements and it causes a segfault. STL sort is able to handle this array without any problems. I looked at the gdb backtrace. It primarily seems to be because the stack is exhausted because of recursive calls to Petsc