dolfinx.la

Linear algebra functionality

Functions

is_orthonormal(basis[, eps])

Check that list of PETSc vectors are orthonormal

matrix_csr(sp[, dtype])

Create a distributed sparse matrix.

orthonormalize(basis)

Orthogoalise set of PETSc vectors in-place

vector(map[, bs, dtype])

Create a distributed vector.

Classes

MatrixCSRMetaClass(sp)

A distributed sparse matrix that uses compressed sparse row storage.

VectorMetaClass(map, bs)

A distributed vector object.

class dolfinx.la.MatrixCSRMetaClass(sp)[source]

Bases: object

A distributed sparse matrix that uses compressed sparse row storage.

Parameters
  • sp – The sparsity pattern that defines the nonzero structure

  • matrix (of the matrix the parallel distribution of the) –

Note

Objects of this type should be created using matrix_csr() and not created using the class initialiser.

class dolfinx.la.Norm(self: dolfinx.cpp.la.Norm, value: int)

Bases: pybind11_object

Members:

l1

l2

linf

frobenius

frobenius = <Norm.frobenius: 3>
l1 = <Norm.l1: 0>
l2 = <Norm.l2: 1>
linf = <Norm.linf: 2>
property name
property value
class dolfinx.la.ScatterMode(self: dolfinx.cpp.la.ScatterMode, value: int)

Bases: pybind11_object

Members:

add

insert

add = <ScatterMode.add: 0>
insert = <ScatterMode.insert: 1>
property name
property value
class dolfinx.la.VectorMetaClass(map, bs)[source]

Bases: object

A distributed vector object.

Parameters
  • map – Index map the describes the size and distribution of the vector

  • bs – Block size

Note

Objects of this type should be created using vector() and not created using the class initialiser.

property array: ndarray
dolfinx.la.create_petsc_vector()

create_vector(index_map: dolfinx.cpp.common.IndexMap, bs: int) -> vec

Create a ghosted PETSc Vec for index map.

dolfinx.la.is_orthonormal(basis, eps: float = 1e-12) bool[source]

Check that list of PETSc vectors are orthonormal

dolfinx.la.matrix_csr(sp, dtype=<class 'numpy.float64'>) MatrixCSRMetaClass[source]

Create a distributed sparse matrix.

The matrix uses compressed sparse row storage.

Parameters
  • sp – The sparsity pattern that defines the nonzero structure of

  • matrix. (the matrix the parallel distribution of the) –

  • dtype – The scalar type.

Returns

A sparse matrix.

dolfinx.la.orthonormalize(basis)[source]

Orthogoalise set of PETSc vectors in-place

dolfinx.la.vector(map, bs=1, dtype=<class 'numpy.float64'>) VectorMetaClass[source]

Create a distributed vector.

Parameters
  • map – Index map the describes the size and distribution of the vector.

  • bs – Block size.

  • dtype – The scalar type.

Returns

A distributed vector.