[petsc-users] Vector Operations

Jed Brown jedbrown at mcs.anl.gov
Wed Dec 25 09:26:30 CST 2013


吕超 <luchao at mail.iggcas.ac.cn> writes:

> Hello!
>
>        Recently, I am writing a program using Petsc, and I encouter a questions.
>
>        the question is as follow:
>
>        In matlab, if a=[1,2,3,4,5], b = [2,2,2,2,2], we can use c=a.*b to get c = [2,4,6,8,10]. This operation is called array multiply in matlab.
>
>        But in Petsc' Vec operations, I can't find a counterpart. So, I want to kown how can I  get c = a.*b in Petsc. Can you help me?

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecPointwiseMult.html

>        I have tried to implement it by using the Petsc's function-VecGetValues().
>
>        But in parallel program, some erros like "undeclared here (not in a function)" always appear. 

Always send the entire error message.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131225/695b639e/attachment.pgp>


More information about the petsc-users mailing list