mikera.transformz
Class ATransform
- java.lang.Object
-
- mikera.transformz.ATransform
-
- All Implemented Interfaces:
- java.lang.Cloneable, ITransform
- Direct Known Subclasses:
- AAffineTransform, AOpTransform, ASizedTransform, CompoundTransform, ScalarFunction, SubsetTransform, VectorFunction
public abstract class ATransform extends java.lang.Object implements java.lang.Cloneable, ITransform
Abstract base class for all vector transformations. A transformation is defined as any function mapping an N-dimensional vector to an M-dimensional vector.
-
-
Constructor Summary
Constructors Constructor and Description ATransform()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description doublecalculateElement(int i, AVector inputVector)Calculates a single element of the output.ATransformclone()Clones the transform, performing a deep copy where neededATransformcompose(ATransform trans)Composes this transformation with another transformation, returning a new combined transformationvoidcomposeWith(ATransform trans)Composes this transformation with a given transformation, mutating the transformation to represent the combined transformabstract intinputDimensions()Returns the number of dimensions required for input vectorsATransforminverse()Return the inverse of this transformation (if possible).booleanisIdentity()Returns true if this transform is known to be the identity function, i.e.booleanisInvertible()Returns true if this transform is invertiblebooleanisLinear()Returns true if this transformation is guaranteed to be linearbooleanisSquare()Returns true if the transform is square (same number of input and output dimensions)abstract intoutputDimensions()Returns the number of dimensions required for output vectorsATransformtakeComponents(Index components)Returns a wrapper transform that returns a subset of this transform's output componentsATransformtakeComponents(int length)Returns a wrapper transform that returns a subset of this transform's output componentsATransformtakeComponents(int start, int length)Returns a wrapper transform that returns a subset of this transform's output componentsAVectortransform(AVector v)Transforms a vector, returning a new transformed vectorabstract voidtransform(AVector source, AVector dest)Transforms the source vector, storing the result in the given destination vectorVectortransform(Vector v)Transforms a vector, returning a new transformed vectorvoidtransformInPlace(AVector v)Transforms a vector destructively.
-
-
-
Method Detail
-
transform
public abstract void transform(AVector source, AVector dest)
Description copied from interface:ITransformTransforms the source vector, storing the result in the given destination vector- Specified by:
transformin interfaceITransform
-
inputDimensions
public abstract int inputDimensions()
Description copied from interface:ITransformReturns the number of dimensions required for input vectors- Specified by:
inputDimensionsin interfaceITransform- Returns:
-
outputDimensions
public abstract int outputDimensions()
Description copied from interface:ITransformReturns the number of dimensions required for output vectors- Specified by:
outputDimensionsin interfaceITransform- Returns:
-
clone
public ATransform clone()
Clones the transform, performing a deep copy where needed- Overrides:
clonein classjava.lang.Object
-
compose
public ATransform compose(ATransform trans)
Composes this transformation with another transformation, returning a new combined transformation
-
composeWith
public void composeWith(ATransform trans)
Composes this transformation with a given transformation, mutating the transformation to represent the combined transform
-
isLinear
public boolean isLinear()
Returns true if this transformation is guaranteed to be linear- Returns:
-
isSquare
public boolean isSquare()
Returns true if the transform is square (same number of input and output dimensions)- Returns:
-
transform
public AVector transform(AVector v)
Transforms a vector, returning a new transformed vector- Parameters:
v-- Returns:
-
transform
public Vector transform(Vector v)
Transforms a vector, returning a new transformed vector- Parameters:
v-- Returns:
-
calculateElement
public double calculateElement(int i, AVector inputVector)Calculates a single element of the output. Not necessarily faster than calculating full output, but can be in some circumstances.
-
transformInPlace
public void transformInPlace(AVector v)
Transforms a vector destructively. Intended for fast non-allocating transforms- Parameters:
v-
-
isIdentity
public boolean isIdentity()
Returns true if this transform is known to be the identity function, i.e. it maps all vectors to themselves
-
takeComponents
public ATransform takeComponents(int length)
Returns a wrapper transform that returns a subset of this transform's output components
-
takeComponents
public ATransform takeComponents(int start, int length)
Returns a wrapper transform that returns a subset of this transform's output components
-
takeComponents
public ATransform takeComponents(Index components)
Returns a wrapper transform that returns a subset of this transform's output components
-
inverse
public ATransform inverse()
Return the inverse of this transformation (if possible). Throws an exception if the inverse cannot be computed.- Returns:
-
isInvertible
public boolean isInvertible()
Returns true if this transform is invertible
-
-
DMelt 3.0 © DataMelt by jWork.ORG