Elementwise minimum is implemented in PETSc.
If you have petsc4py, you can use the following:
def pwmin(x, y):
z = as_backend_type(x).vec().duplicate()
z.pointwiseMin(as_backend_type(x).vec(),
as_backend_type(y).vec())
return PETScVector(z)
Alternatively you can implement pointwise minimum as follows:
def pwmin(x, y):
z = x - y
z.abs()
z -= x
z -= y
z /= -2.0
return z
This is not as fast as the PETSc implementation but faster than numpy.