Skip to main content
`Ctrl`+`K`

# petsc4py.PETSc.NullSpace

class petsc4py.PETSc.NullSpace

  Bases: `Object`

  Nullspace object.

  See also

  `MatNullSpace`

  Methods Summary

  `create`([constant, vectors, comm]) | Create the null space.
  `createRigidBody`(coords) | Create rigid body modes from coordinates.
  `destroy`() | Destroy the null space.
  `getFunction`() | Return the callback to remove the nullspace.
  `getVecs`() | Return the vectors defining the null space.
  `hasConstant`() | Return whether the null space contains the constant.
  `remove`(vec) | Remove all components of a null space from a vector.
  `setFunction`(function[, args, kargs]) | Set the callback to remove the nullspace.
  `test`(mat) | Return if the claimed null space is valid for a matrix.
  `view`([viewer]) | View the null space.

  Methods Documentation

  create(constant=False, vectors=(), comm=None)

    Create the null space.

    Collective.

    Parameters:

      - constant (bool) – A flag to indicate the null space contains the constant vector.

      - vectors (Sequence[Vec]) – The sequence of vectors that span the null space.

      - comm – MPI communicator, defaults to `Sys.getDefaultComm`.

    Return type:

      Self

    See also

    `destroy`, `MatNullSpaceCreate`

    Source code at petsc4py/PETSc/Mat.pyx:6115

  createRigidBody(coords)

    Create rigid body modes from coordinates.

    Collective.

    Parameters:

      coords (Vec) – The block coordinates of each node. Requires the block size to have been set.

    Return type:

      Self

    See also

    `MatNullSpaceCreateRigidBody`

    Source code at petsc4py/PETSc/Mat.pyx:6151

  destroy()

    Destroy the null space.

    Collective.

    See also

    `create`, `MatNullSpaceDestroy`

    Source code at petsc4py/PETSc/Mat.pyx:6102

    Return type:

      Self

  getFunction()

    Return the callback to remove the nullspace.

    Not collective.

    See also

    `setFunction`

    Source code at petsc4py/PETSc/Mat.pyx:6242

    Return type:

      MatNullFunction

  getVecs()

    Return the vectors defining the null space.

    Not collective.

    See also

    `MatNullSpaceGetVecs`

    Source code at petsc4py/PETSc/Mat.pyx:6220

    Return type:

      list[Vec]

  hasConstant()

    Return whether the null space contains the constant.

    Not collective.

    See also

    `MatNullSpaceGetVecs`

    Source code at petsc4py/PETSc/Mat.pyx:6206

    Return type:

      bool

  remove(vec)

    Remove all components of a null space from a vector.

    Collective.

    Parameters:

      vec (Vec) – The vector from which the null space is removed.

    Return type:

      None

    See also

    `MatNullSpaceRemove`

    Source code at petsc4py/PETSc/Mat.pyx:6256

  setFunction(function, args=None, kargs=None)

    Set the callback to remove the nullspace.

    Logically collective.

    Parameters:

      - function (MatNullFunction) – The callback.

      - args (tuple[Any, ...] | None) – Positional arguments for the callback.

      - kargs (dict[str, Any] | None) – Keyword arguments for the callback.

    Return type:

      None

    See also

    `getFunction`, `MatNullSpaceSetFunction`

    Source code at petsc4py/PETSc/Mat.pyx:6172

  test(mat)

    Return if the claimed null space is valid for a matrix.

    Collective.

    Parameters:

      mat (Mat) – The matrix to check.

    Return type:

      bool

    See also

    `MatNullSpaceTest`

    Source code at petsc4py/PETSc/Mat.pyx:6273

  view(viewer=None)

    View the null space.

    Collective.

    Parameters:

      viewer (Viewer | None) – A `Viewer` instance or `None` for the default viewer.

    Return type:

      None

    See also

    `Viewer`, `MatNullSpaceView`

    Source code at petsc4py/PETSc/Mat.pyx:6083