[petsc-users] MatCreateTranspose

Pierre Jolivet pierre at joliv.et
Fri Apr 12 05:22:29 CDT 2024



> On 12 Apr 2024, at 11:51 AM, Carl-Johan Thore <carljohanthore at gmail.com> wrote:
> 
> On Fri, Apr 12, 2024 at 11:16 AM Pierre Jolivet <pierre at joliv.et <mailto:pierre at joliv.et>> wrote:
>> 
>> 
>>> On 12 Apr 2024, at 11:10 AM, Carl-Johan Thore <carljohanthore at gmail.com <mailto:carljohanthore at gmail.com>> wrote:
>>> 
>>> Pierre, I see that you've already done a merge request for this. Thanks!
>>> I have tested this and it works nicely in my application
>> 
>> I guess your matrix is symmetric in pattern?
>> Because otherwise, I don’t think this should work.
>> But if it’s OK for your use case, I could simply add a PetscCheck() that the input Mat is symmetric and then get this integrated (better to have something partially working than nothing at all, I guess).
>> Please let me know.
>> 
>> Thanks,
>> Pierre
> 
> Yes, unless I'm mistaken it's structurally symmetric. Would be great to have this integrated.

OK, I’ll work on finalizing this.

> (I don't now what you have in mind for the check, but MatIsStructurallySymmetric did not work for me)

You’ll have to call MatSetOption(A, MAT_STRUCTURALLY_SYMMETRIC, PETSC_TRUE) before KSPSolveTranspose().

Thanks,
Pierre

> /Carl-Johan
> 
> 
>  
>>> /Carl-Johan
>>> 
>>> On Wed, Apr 10, 2024 at 8:24 AM Carl-Johan Thore <carljohanthore at gmail.com <mailto:carljohanthore at gmail.com>> wrote:
>>>> 
>>>> 
>>>> On Tue, Apr 9, 2024 at 5:31 PM Pierre Jolivet <pierre at joliv.et <mailto:pierre at joliv.et>> wrote:
>>>>> 
>>>>>> On 9 Apr 2024, at 4:19 PM, Carl-Johan Thore <carljohanthore at gmail.com <mailto:carljohanthore at gmail.com>> wrote:
>>>>>> 
>>>>>> This Message Is From an External Sender
>>>>>> This message came from outside your organization.
>>>>>> Thanks for the suggestion. I don't have a factored matrix (and can't really use direct linear solvers) so MatSolveTranspose doesn't seem to be an option. 
>>>>>> I should have mentioned that I've also tried KSPSolveTranspose but that doesn't work with pcredistribute
>>>>> 
>>>>> I’m not a frequent PCREDISTRIBUTE user, but it looks like https://urldefense.us/v3/__https://petsc.org/release/src/ksp/pc/impls/redistribute/redistribute.c.html*line332__;Iw!!G_uCfscf7eWS!Z3r5Vel5sbPcmhUVW14FZ6PsYuoOjHTQALmGl5fdDTHAI1ylX6YQfiOTutFQCeLQewR7-dZQ2k-7sSa95-LFDg$  could be copy/paste’d into PCApplyTranspose_Redistribute() by just changing a MatMult() to MatMultTranspose() and KSPSolve() to KSPSolveTranspose().
>>>>> Would you be willing to contribute (and test) this?
>>>>> Then, KSPSolveTranspose() — which should be the function you call — will work.
>>>>> 
>>>>> Thanks,
>>>>> Pierre
>>>> 
>>>> Thanks, that sounds promising. Yes, I'll try to make a contribution
>>>> /Carl-Johan
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240412/649c5bf1/attachment-0001.html>


More information about the petsc-users mailing list