[petsc-users] petsc4py bool type
Garth N. Wells
gnw20 at cam.ac.uk
Tue Apr 25 11:48:58 CDT 2017
I'm seeing some behaviour with bool types in petsc4py that I didn't
expect. In the Python interface, returned Booleans have type '<class
'int'>', where I expected them to have type ' <class 'bool'>'. Below
program illustrates issue. Seems to be related to bint in cython. Am I
doing something wrong?
Garth
from petsc4py import PETSc
A = PETSc.Mat()
A.createAIJ((2, 2))
A.setOption(PETSc.Mat.Option.SYMMETRIC, True)
symm = A.isSymmetricKnown()
print("Symmetry set:", symm[0] is True)
print("Symmetry set:", symm[0] == True)
print("Bool type:", type(symm[0]))
More information about the petsc-users
mailing list