question on solving the transpose of a system

Randall Mackie randy at geosystem.us
Mon Sep 25 16:10:51 CDT 2006


Barry,

I tried in my program simply doing an in-place transpose:

	Call MatTranspose (A, PETSC_NULL, ierr)

and it returns an error code of 0, but the KSPSolve still
seems to be on the untransposed system. Not sure how to
actually get the transpose inside my code.

Randy


Barry Smith wrote:
>   Randy,
> 
>> Now, if I want to solve (2) above, do I simply make a call to
>> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right
>> hand side of (2)
> 
>    Yes, this is the way we intend it to be used. You should not
> have to construct the transposed matrices.
> 
>   Questions:
> 
> Are you using KSPSetNullSpace()?
> Are you using right or left preconditioning? Or not setting it?
> What KSP method are you using?
> What preconditioner are you using?
> 
>    Barry
> 
> 
> 
> On Mon, 25 Sep 2006, Randall Mackie wrote:
> 
>> I have a situation where I have to solve the following problems:
>>
>> 1) Ax=b
>>
>> 2) (A)^T u = c
>>
>> A is not symmetric.
>>
>>
>> After I set up my A matrix and the preconditioner P (which is NOT the same as
>> A),
>> I solve it like so:
>>
>>
>>         call set_P(da,P,l,m,n,period,resist,x,y,z)
>>         call set_A(da,A,l,m,n,period,resist,x,y,z)
>>
>>         call MatSetBlockSize(A,3,ierr)
>>         call MatSetBlockSize(P,3,ierr)
>>
>>         call KSPSetOperators(ksp,A,P,DIFFERENT_NONZERO_PATTERN,ierr)
>>         call KSPSetInitialGuessNonzero(ksp,PETSC_TRUE,ierr)
>>
>>             call KSPSolve(ksp,b,xsol,ierr)
>>             call KSPGetIterationNumber(ksp,its,ierr)
>>             call KSPGetConvergedReason(ksp,reason,ierr)
>>
>>
>> Now, if I want to solve (2) above, do I simply make a call to
>> KSPSolveTranspose(ksp,b,xsol), where I've set b to the right
>> hand side of (2), or do I have to create the transposes of both
>> A and the preconditioner and just use KSPSolve?
>>
>>
>> When I've tried just using KSPSolveTranspose, the preconditioned residual
>> norm falls, but not as rapidly as when doing (1), and the true residual norm
>> seems not to change much at all.
>>
>>
>> Thanks, Randy
>>
>>
>>
> 

-- 
Randall Mackie
GSY-USA, Inc.
PMB# 643
2261 Market St.,
San Francisco, CA 94114-1600
Tel (415) 469-8649
Fax (415) 469-5044

California Registered Geophysicist
License No. GP 1034




More information about the petsc-users mailing list