[petsc-users] Using "long int" variable in MatSetValues

Satish Balay balay at mcs.anl.gov
Tue Jun 2 15:47:27 CDT 2020


You need PetscInt to be 64-bit-integer - so rebuild PETSc with the option: --with-64-bit-indices=1

Satish

On Tue, 2 Jun 2020, Evan Um wrote:

> Dear PETSC users,
> 
> Using C++, I tried to build a very large sparse matrix and had a problem
> shown below. Indices of the matrix should be "long int" rather than "int"
> but PETSC does not allow this. How could I dodge this problem? Thanks for
> your comments.
> 
> Regards,
> Evan
> 
> fe.cpp(2009): error: argument of type "long *" is incompatible with
> parameter of type "const PetscInt={int} *"
>                 ierr=MatSetValues(Bseq, 1, &mat_b_i_partitioned[i], 1,
> &mat_b_j_partitioned[i], &mat_b_val_partitioned[i], ADD_VALUES);
> 



More information about the petsc-users mailing list