Basis

class btensor.basis.Basis(argument, *, parent=None, metric=None, name=None, orthonormal=None)[source]

Class to represent a vector space basis, which can be used to define a Tensor object.

Parameters
  • argument (int | BasisArgument) – Integer to create a rootbasis or sequence, slice, or array to create a derived basis.

  • parent (Basis | None) – Parent basis object for the derived basis. If it is None, the basis is a root-basis. Default: None.

  • metric (np.ndarray | None) – Metric array, representing the inner product of the basis with itself. It is used to raise and lower tensor indices, if the basis is non-orthonormal. Default: None.

  • name (str | None) – Name of the basis, which is used for string representations of basis objects. Basis names are not required to be unique. Default: None.

  • orthonormal (bool | None) – Set True, if the basis is orthonormal, i.e. the metric is the identity matrix. If None, the basis is assumed orthonormal if a) it is a root basis without metric or b) it is a derived basis with an orthonormal parent basis, defined in terms of a permutation + selection (slice or 1D sequence). Default: None.

Return type

None

Methods

__init__

Initialize new Basis object.

get_by_id

Returns a previously defined basis based on its ID, if it exists.

get_common_parent

Find first common ancestor basis between multiple bases.

get_overlap

Get overlap matrix with another basis as a Tensor.

get_parents

Get list of parent bases ordered from direct parent to root basis.

get_transformation

Get transformation matrix to another basis as a Tensor with general variance.

get_transformation_from

Get transformation matrix from another basis as a Tensor with variance (-1, 1).

get_transformation_to

Get transformation matrix to another basis as a Tensor with variance (-1, 1).

is_compatible_with

Check if basis is compatible with another basis.

is_derived_from

Check if the basis is derived from a second basis.

is_parent_of

Check if the basis is parent of a second basis.

is_root

True if basis is a root-basis, False otherwise.

make_intersect_basis

Make the smallest orthonormal basis, which spans the intersecting space of both the basis and another basis.

make_subbasis

Make a new basis with coefficients or indices in reference to the current basis.

make_union_basis

Make the smallest orthonormal basis, which spans both the basis and one or more other bases.

same_root

Check if all bases have the same root.

Attributes

T

alias of TypeVar('T')

id

Unique ID of basis.

is_orthonormal

True if the basis is orthonormal.

metric

Metric matrix, used to raise and lower tensor indices.

name

Name of basis.

parent

Parent of basis or None, if the basis is a root-basis.

root

Root-basis of the basis or None, if the basis itself is the root-basis.

size

Size of basis.

space

Space spanned by basis.