Re: [petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-09-25 Thread Jose E. Roman
Thanasis: I have finished the change that I mentioned in my previous email, the details are here https://gitlab.com/slepc/slepc/-/merge_requests/586 The change has been already merged into the main branch, and thus will be included in version 3.20, to be released on Friday this week. You

Re: [petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-08-30 Thread Jose E. Roman
The conversion from MATAIJ to MATDENSE should be very cheap, see https://gitlab.com/petsc/petsc/-/blob/main/src/mat/impls/dense/seq/dense.c?ref_type=heads#L172 The matrix copy hidden inside createFromMat() is likely more expensive. I am currently working on a modification of BV that will be

Re: [petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-08-29 Thread Thanasis Boutsikakis
Thanks Jose, This works indeed. However, I was under the impression that this conversion might be very costly for big matrices with low sparsity and it would scale with the number of non-zero values. Do you have any idea of the efficiency of this operation? Thanks > On 29 Aug 2023, at

Re: [petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-08-29 Thread Barry Smith
Ah, there is https://petsc.org/release/manualpages/Mat/MATSOLVERSPQR/#matsolverspqr See also https://petsc.org/release/manualpages/Mat/MatGetFactor/#matgetfactor and https://petsc.org/release/manualpages/Mat/MatQRFactorSymbolic/ > On Aug 29, 2023, at 1:17 PM, Jed Brown wrote: > >

Re: [petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-08-29 Thread Jed Brown
Suitesparse includes a sparse QR algorithm. The main issue is that (even with pivoting) the R factor has the same nonzero structure as a Cholesky factor of A^T A, which is generally much denser than a factor of A, and this degraded sparsity impacts Q as well. I wonder if someone would like to

Re: [petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-08-29 Thread Jose E. Roman
The result of bv.orthogonalize() is most probably a dense matrix, and the result replaces the input matrix, that's why the input matrix is required to be dense. You can simply do this: bv = SLEPc.BV().createFromMat(A.convert('dense')) Jose > El 29 ago 2023, a las 18:50, Thanasis

Re: [petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-08-29 Thread Barry Smith
Are the nonzero structures of all the rows related? If they are, one could devise a routine to take advantage of this relationship, but if the nonzero structures of each row are "randomly" different from all the other rows, then it is difficult to see how one can take advantage of the

[petsc-users] Orthogonalization of a (sparse) PETSc matrix

2023-08-29 Thread Thanasis Boutsikakis
Hi all, I have the following code that orthogonalizes a PETSc matrix. The problem is that this implementation requires that the PETSc matrix is dense, otherwise, it fails at bv.SetFromOptions(). Hence the assert in orthogonality(). What could I do in order to be able to orthogonalize sparse