[petsc-users] How to call a lapack routine in the petsc?

Matthew Knepley knepley at gmail.com
Thu Dec 11 21:57:22 CST 2014


On Thu, Dec 11, 2014 at 9:54 PM, Fande Kong <fdkong.jd at gmail.com> wrote:
>
> Hi Barry,
>
> Thanks.
>
> I know how to solve a dense linear system in the petsc, but I was
> wondering how to call a Lapack routine in the petsc.
>

This is from dt.c:

#include <petscblaslapack.h>

  PetscBLASInt LDZ, N;

  ierr = PetscBLASIntCast(npoints,&N);CHKERRQ(ierr);
  LDZ  = N;
  ierr = PetscFPTrapPush(PETSC_FP_TRAP_OFF);CHKERRQ(ierr);

PetscStackCallBLAS("LAPACKsteqr",LAPACKsteqr_("I",&N,x,w,Z,&LDZ,work,&info));
  ierr = PetscFPTrapPop();CHKERRQ(ierr);
  if (info) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"xSTEQR error");

   Matt


>
> On Thu, Dec 11, 2014 at 8:47 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>
>>
>> > On Dec 11, 2014, at 9:33 PM, Fande Kong <fdkong.jd at gmail.com> wrote:
>> >
>> > Hi all,
>> >
>> > How to call a Lapack routine to solve a dense linear system? Any simple
>> example?
>>
>>    Create the Mat with MatCreateSeqDense() then create the usual KSP and
>> use for the solver options -pc_type lu -ksp_type preonly
>>
>>     See src/ksp/ksp/examples/tutorials/ex30.c
>>
>>
>>    Barry
>>
>> >
>> > Thanks,
>> >
>>
>>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141211/74879876/attachment.html>


More information about the petsc-users mailing list