How to use bmesh.ops.transform?
bmesh.ops.transform() expects a 3x3 rotation matrix or 4x4 transformation matrix each for matrix and space.


matrix specifies the desired transformation, which can be anything with a 4x4 matrix (translation, rotation, scaling, skewing, mirroring etc.).
space specifies the space in which this transformation is supposed to happen in. If not specified, the transformation will happen in local space (object space). If you give it the object's matrix_world, the transformation will happen in global space (world space). But you can give it any desired space if necessary (e.g. to rotate around an arbitrary point in space instead of the object's origin).


Simple example:
Translation in local and global space of an rotated object




Mesh with no transformation applied yet. The object is rotated by 45° around X.
Translate mesh 1 unit up on Z-axis in local space:bmesh.ops.transform(bm, matrix=Matrix.Translation((0,0,1)), verts=bm.verts)
Same as 1.
Translate mesh 1 unit up on Z-axis, but using matrix_world of the object to perform the transformation in global space:bmesh.ops.transform(bm, matrix=Matrix.Translation((0,0,1)), space=bpy.context.object.matrix_world, verts=bm.verts)


Giving a space-matrix is the same as multiplying the inverse of the transformation space matrix by the transformation matrix and the transformation space matrix:

matrix_world = bpy.context.object.matrix_world
bmesh.ops.transform(bm, matrix=matrix_world.inverted() * Matrix.Translation((0,0,1)) * matrix_world, verts=bm.verts)


Matrix tutorial:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/