Change double to PetscScalar, but kept the third argument. This function is only used for test purpose.