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.Shift(offset)

Bases: nutils.transform.Square

Shift transformation \(x ↦ x + b\)

Parameters

offset (numpy.ndarray) – The offset \(b\).

class nutils.transform.Identity(ndims)

Bases: nutils.transform.Shift

Identity transformation \(x ↦ x\)

Parameters

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

class nutils.transform.Scale(scale, offset)

Bases: nutils.transform.Square

Affine transformation \(x ↦ a x + b\), with \(a\) a scalar

Parameters
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.Identifier(ndims, token)

Bases: nutils.transform.Identity

Generic identifier

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

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