[petsc-users] logical operation for Vec

Barry Smith bsmith at mcs.anl.gov
Mon May 10 20:36:11 CDT 2010


  No, nothing like that. But this is easily done by call VecGetArray() looping over the array and applying the check to each entry.

  barry

On May 10, 2010, at 8:31 PM, Yujie wrote:

> Dear PETSc Developers,
> 
> I am wondering whether there is a function for Vec.
> 
> Assuming
> 
> Vec v;
> 
> double d_test;
> 
> This function can compare each values (v(i)) of v with d_test and
> return the logical values contained in Vec v_logi (such as
> if(v(i)>d_test)
>  v_logi(i)=0;
> else
>  v_logi(i)=1;  )
> 
> Thanks a lot.
> 
> Regards,
> Yujie



More information about the petsc-users mailing list