cc.redberry.core.tensor
Class ApplyIndexMapping
- java.lang.Object
-
- cc.redberry.core.tensor.ApplyIndexMapping
-
public final class ApplyIndexMapping extends java.lang.ObjectStatic methods to rename indices of tensors.- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor and Description ApplyIndexMapping()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static TensorapplyIndexMapping(Tensor tensor, Mapping mapping)Applies specified mapping of indices to tensor.static TensorapplyIndexMapping(Tensor tensor, Mapping mapping, int[] forbidden)Applies specified mapping of indices to tensor preventing some dummy index to be equal to one of the specified forbidden indices.static TensorapplyIndexMappingAndRenameAllDummies(Tensor tensor, Mapping mapping, int[] allowedDummies)static TensorapplyIndexMappingAutomatically(Tensor tensor, Mapping mapping)Applies given mapping of indices to tensor.static TensorapplyIndexMappingAutomatically(Tensor tensor, Mapping mapping, int[] forbidden)Applies given mapping of indices to tensor.static TensoroptimizeDummies(Tensor t)Minimizes total dummies count.static TensorrenameDummy(Tensor tensor, int[] forbiddenNames)Renames dummy indices of tensor prohibiting some dummy index to be equal to one of the specified forbidden indices.static TensorrenameDummy(Tensor tensor, int[] forbiddenNames, int[] allowedDummiesNames)Renames dummy indices of tensor prohibiting some dummy index to be equal to one of the specified forbidden indices.static TensorrenameDummy(Tensor tensor, int[] forbiddenNames, TIntHashSet added)Renames dummy indices of tensor prohibiting some dummy index to be equal to one of the specified forbidden indices.static TensorrenameIndicesOfFieldsArguments(Tensor tensor, TIntSet forbidden)
-
-
-
Method Detail
-
renameDummy
public static Tensor renameDummy(Tensor tensor, int[] forbiddenNames, int[] allowedDummiesNames)
Renames dummy indices of tensor prohibiting some dummy index to be equal to one of the specified forbidden indices.- Parameters:
tensor- tensorforbiddenNames- forbidden indices namesallowedDummiesNames- array of allowed dummies names- Returns:
- tensor with renamed dummies
-
renameDummy
public static Tensor renameDummy(Tensor tensor, int[] forbiddenNames, TIntHashSet added)
Renames dummy indices of tensor prohibiting some dummy index to be equal to one of the specified forbidden indices.- Parameters:
tensor- tensorforbiddenNames- forbidden indices namesadded- set which will be added by generated dummy indices- Returns:
- tensor with renamed dummies
-
renameDummy
public static Tensor renameDummy(Tensor tensor, int[] forbiddenNames)
Renames dummy indices of tensor prohibiting some dummy index to be equal to one of the specified forbidden indices.- Parameters:
tensor- tensorforbiddenNames- forbidden indices names- Returns:
- tensor with renamed dummies
-
optimizeDummies
public static Tensor optimizeDummies(Tensor t)
Minimizes total dummies count.- Parameters:
t- tensor- Returns:
- result
-
applyIndexMappingAutomatically
public static Tensor applyIndexMappingAutomatically(Tensor tensor, Mapping mapping)
Applies given mapping of indices to tensor. In contrast toapplyIndexMapping(Tensor, Mapping, int[])this method does not assumes thatfromindices matches exactly free indices of tensor: if some free index of specified tensor does not present in map, then it will be mapped on itself; if some index present in map, but does not present in free indices of tensor, then this mapping rule will be ignored.- Parameters:
tensor- tensormapping- mapping of indices- Returns:
- tensor with renamed indices
- Throws:
java.lang.IllegalArgumentException- iffrom.length != to.length
-
applyIndexMappingAutomatically
public static Tensor applyIndexMappingAutomatically(Tensor tensor, Mapping mapping, int[] forbidden)
Applies given mapping of indices to tensor. In contrast toapplyIndexMapping(Tensor, Mapping, int[])this method does not assumes thatfromindices matches exactly free indices of tensor: if some free index of specified tensor does not present in map, then it will be mapped on itself; if some index present in map, but does not present in free indices of tensor, then this mapping rule will be ignored.- Parameters:
tensor- tensormapping- mapping of indicesforbidden- forbidden indices names- Returns:
- tensor with renamed indices
- Throws:
java.lang.IllegalArgumentException- iffrom.length != to.length
-
applyIndexMapping
public static Tensor applyIndexMapping(Tensor tensor, Mapping mapping)
Applies specified mapping of indices to tensor.- Parameters:
tensor- tensormapping- mapping of indices- Returns:
- tensor with renamed indices
-
applyIndexMapping
public static Tensor applyIndexMapping(Tensor tensor, Mapping mapping, int[] forbidden)
Applies specified mapping of indices to tensor preventing some dummy index to be equal to one of the specified forbidden indices.- Parameters:
tensor- tensormapping- mapping of indicesforbidden- forbidden indices- Returns:
- tensor with renamed indices
-
applyIndexMappingAndRenameAllDummies
public static Tensor applyIndexMappingAndRenameAllDummies(Tensor tensor, Mapping mapping, int[] allowedDummies)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG