You are attempting to pass the entire aA array into each MatSetValues() call when you should pass one row with each call. Use
PetscCallA(MatSetValues(A,1,i,4,j,aA(i+1,:),INSERT_VALUES,ierr)) > On Aug 19, 2023, at 4:47 PM, Sanjay Govindjee <s...@berkeley.edu> wrote: > > I recently got a copy of E.Bueler's petsc book and was converting the > programs to fortran for my students and have run into a compile error that > I can not figure out. I comment out the MatSetValues line the code compiles > fine. > > When I run make on vecmatkspf.F90, I get the error: > 42 | PetscCallA(MatSetValues(A,1,i,4,j,aA,INSERT_VALUES,ierr)) > | 1 > Error: There is no specific subroutine for the generic 'matsetvalues' at (1) > My petsc set works, runs with my FEA code and compiles and runs the fortran > programs in the petsc tutorials directories just fine. And in particular, > compiles > and runs the C versions from Bueler. > > I've attached the make file and the source. I must be doing something > obviously wrong but I can not spot it. > > -sanjay > -- > > > <vecmatkspf.F90><makefile.txt>