[petsc-dev] MAT_HERMITIAN
Pierre Jolivet
pierre.jolivet at enseeiht.fr
Wed Sep 11 05:55:28 CDT 2019
(Putting back petsc-dev on c/c)
I don’t think you are the one that needs to do the changes.
There should be clarifications from the PETSc side of things, first.
From the man page your are quoting (https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATSEQSBAIJ.html <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATSEQSBAIJ.html>):
1) how to make a SBAIJ Mat Hermitian but not symmetric? Is this handled by PETSc? Is this legal to do MatSetOption(A, MAT_SYMMETRIC, PETSC_FALSE) followed by MatSetOption(A, MAT_HERMITIAN, PETSC_TRUE)? I think this is the case where bs>1 is not handled internally by PETSc, so for this case it should be OK to error out.
2) “Hermitian symmetric” is a fancy way of saying that the matrix has no imaginary part. Or is just “Hermitian" what is supposed to be written on the page? In which case, how do you tell to PETSc that you are indeed dealing with a matrix with no imaginary part.
Thanks,
Pierre
> On 11 Sep 2019, at 11:51 AM, Jose E. Roman <jroman at dsic.upv.es> wrote:
>
> Now I understand better. You are right. Maybe I should do some changes in SLEPc. I will think about this next week.
>
>
>> El 11 sept 2019, a las 11:38, Pierre Jolivet <pierre.jolivet at enseeiht.fr> escribió:
>>
>>
>>
>>> On 11 Sep 2019, at 11:21 AM, Jose E. Roman <jroman at dsic.upv.es> wrote:
>>>
>>> In https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MATSEQSBAIJ.html it says "To make it Hermitian symmetric you can call MatSetOption(Mat, MAT_HERMITIAN);" So my understanding is that in SBAIJ assumes MAT_SYMMETRIC and the user must set MAT_HERMITIAN if desired.
>>
>> Right, that is exactly what you do in STMatSetHermitian. You get from the user a SBAIJ matrix (so SYMMETRIC = true), and you set yourself HERMITIAN = true.
>>
>>> I don't think it makes sense to set both MAT_HERMITIAN and MAT_SYMMETRIC.
>>
>> Why? A symmetric (or Hermitian) matrix with no imaginary part is both Hermitian and symmetric, so at least this set of options defines correctly the structure of the matrix (which is not the case if you only assume it is _either_ symmetric or Hermitian).
>>
>>> But I may be wrong because I find this part of PETSc very confusing.
>>>
>>>
>>>> El 11 sept 2019, a las 11:08, Jose E. Roman <jroman at dsic.upv.es> escribió:
>>>>
>>>> Do you mean setting both flags MAT_HERMITIAN and MAT_SYMMETRIC? Is this possible?
>>
>> It was possible before my commit for bs == 1, but not for bs > 1.
>>
>> At least now my tests are not failing.
>>
>>>>> El 11 sept 2019, a las 11:04, Pierre Jolivet <pierre.jolivet at enseeiht.fr> escribió:
>>>>>
>>>>> Symmetric <=> a_ij = a_ji
>>>>> Hermitian <=> a_ij = conj(a_ji)
>>>>>
>>>>> Symmetric + Hermitian <=> a_ij = conj(a_ji) = a_ji <=> imag(a_ji) = 0 \forall ij
>>>>>
>>>>> Or am I stupid?
>>>>>
>>>>>> On 11 Sep 2019, at 10:59 AM, Jose E. Roman <jroman at dsic.upv.es> wrote:
>>>>>>
>>>>>> Not sure if I understand you. Do you mean that a complex SBAIJ Mat with MAT_HERMITIAN flag can be assumed to have zero imaginary part? I don't think so. This matrix should have real diagonal entries, but off-diagonal entries should be allowed to have nonzero imaginary part. This is what is done in MatMult_SeqSBAIJ_1_Hermitian(), where off-diagonal entries are conjugated when used for the strict lower triangular part. So I guess the right fix is to implement MatMult_SeqSBAIJ_2_Hermitian(), MatMult_SeqSBAIJ_3_Hermitian() and so on with appropriate use of PetscConj().
>>>>>>
>>>>>> Jose
>>>>>>
>>>>>>> El 11 sept 2019, a las 10:36, Pierre Jolivet <pierre.jolivet at enseeiht.fr> escribió:
>>>>>>>
>>>>>>> Nevermind, this is the wrong fix.
>>>>>>> The proper fix is in PETSc. It should not error out if the matrix is also symmetric.
>>>>>>> Indeed, complex symmetric Hermitian => complex with no imaginary part.
>>>>>>> Thus all operations like MatMult, MatMultHermitianTranspose, Cholesky… will work for bs > 1, since all is filled with zeroes.
>>>>>>> I will take care of this, I’m c/c’ing petsc-dev so that they don’t have to “reverse engineer” the trivial change to MatSetOption_SeqSBAIJ.
>>>>>>>
>>>>>>> Sorry about the noise.
>>>>>>>
>>>>>>> Thank you,
>>>>>>> Pierre
>>>>>>>
>>>>>>>> On 10 Sep 2019, at 8:37 AM, Pierre Jolivet <pierre.jolivet at enseeiht.fr> wrote:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>> Could you consider not setting MAT_HERMITIAN here http://slepc.upv.es/documentation/current/src/sys/classes/st/interface/stsles.c.html#line276 when using SBAIJ matrices with bs > 1?
>>>>>>>> This makes PETSc error out with
>>>>>>>> # [1]PETSC ERROR: No support for this operation for this object type
>>>>>>>> # [1]PETSC ERROR: No support for Hermitian with block size greater than 1
>>>>>>>>
>>>>>>>> The change does not bring any regression, since PETSc is always giving an error without it, but on the contrary, it improves the range of applicability of SLEPc, e.g., for complex Hermitian problems with SBAIJ matrices and bs > 1 that _don’t_ require the flag MAT_HERMITIAN set to true.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Pierre
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190911/afedb299/attachment.html>
More information about the petsc-dev
mailing list