>
>
> 1) the asserts
>  PetscValidScalarPointer(r,3);
>   PetscValidScalarPointer(c,4);
>
>   are over zealous. They should actually be if (n)
> PetscValidScalarPointer(r,3);
>
>
That fixed the problem.


>   BTW: we should have an additional assert that n >=0
>

I guess I should have done a if (n<0) SETERRQ(...

>
>   ierr = PetscMemzero(c,nmax*sizeof(PetscReal));CHKERRQ(ierr);
>   if (!n) {
>     *r = 0.0;
>    ^^^^ assumes there is space in r for something even if the array
> dimension is zero which is not good.
>
>
 I'm not sure how to test this so I just protected this line.

Reply via email to