transform

The transform module.

class nutils.transform.TransformItem(todims, fromdims)

Bases: nutils.types.Singleton

Affine transformation.

Base class for transformations of the type \(x ↦ A x + b\).

Parameters
  • todims (int) – Dimension of the affine transformation domain.

  • fromdims (int) – Dimension of the affine transformation range.

class nutils.transform.Matrix(linear, offset)

Bases: nutils.transform.TransformItem

Affine transformation \(x ↦ A x + b\), with \(A\) an \(n×m\) matrix, \(n≥m\)

Parameters
class nutils.transform.Square(linear, offset)

Bases: nutils.transform.Matrix

Affine transformation \(x ↦ A x + b\), with \(A\) square

Parameters
class nutils.transform.Identity(ndims)

Bases: nutils.transform.Square

Identity transformation \(x ↦ x\)

Parameters

ndims (int) – Dimension of \(x\).

class nutils.transform.Index(ndims, index)

Bases: nutils.transform.Identity

Identity transform with index

This transformation serves as an element-specific or topology-specific index to form the basis of transformation lookups. Otherwise, the transform behaves like an identity.

class nutils.transform.Updim(linear, offset, isflipped)

Bases: nutils.transform.Matrix

Affine transformation \(x ↦ A x + b\), with \(A\) an \(n×(n-1)\) matrix

Parameters
class nutils.transform.EvaluableTransformChain(args, todims, fromdims)

Bases: nutils.evaluable.Evaluable

The Evaluable equivalent of a transform chain.

todims

The to dimension of the transform chain.

Type

int

fromdims

The from dimension of the transform chain.

Type

int

static empty(_EvaluableTransformChain__dim)

Return an empty evaluable transform chain with the given dimension.

Parameters

dim (int) – The to and from dimensions of the empty transform chain.

Returns

The empty evaluable transform chain.

Return type

EvaluableTransformChain

static from_argument(name, todims, fromdims)

Return an evaluable transform chain that evaluates to the given argument.

Parameters
  • name (str) – The name of the argument.

  • todims (int) – The to dimension of the transform chain.

  • fromdims (int) – The from dimension of the transform chain.

Returns

The transform chain that evaluates to the given argument.

Return type

EvaluableTransformChain

property linear: nutils.evaluable.Array

The linear transformation matrix of the entire transform chain. Shape (todims,fromdims).

Type

nutils.evaluable.Array

property basis: nutils.evaluable.Array

A basis for the root coordinate system such that the first fromdims vectors span the tangent space. Shape (todims,todims).

Type

nutils.evaluable.Array

apply(self, _EvaluableTransformChain__coords)

Apply this transform chain to the last axis given coordinates.

Parameters

coords (nutils.evaluable.Array) – The coordinates to transform with shape (...,fromdims).

Returns

The transformed coordinates with shape (...,todims).

Return type

nutils.evaluable.Array

index_with_tail_in(self, _EvaluableTransformChain__sequence)

Return the evaluable index of this transform chain in the given sequence.

Parameters

sequence (nutils.transformseq.Transforms) – The sequence of transform chains.

Returns

See also

nutils.transformseq.Transforms.index_with_tail()

the unevaluable version of this method