Documentation of 'cc.redberry.core.utils.TensorUtils' Java class
TensorUtils
cc.redberry.core.utils

Class TensorUtils



  • public class TensorUtils
    extends java.lang.Object
    This class contains various useful methods related with tensors.
    Since:
    1.0
    • Method Detail

      • haveIndicesIntersections

        public static boolean haveIndicesIntersections(Tensor u,
                                                       Tensor v)
        Returns true if at least one free index of u is contracted with some free index of v.
        Parameters:
        u - tensor
        v - tensor
        Returns:
        true if at least one free index of u is contracted with some free index of v
      • isZeroOrIndeterminate

        public static boolean isZeroOrIndeterminate(Tensor tensor)
      • isIndeterminate

        public static boolean isIndeterminate(Tensor tensor)
      • isInteger

        public static boolean isInteger(Tensor tensor)
      • isNaturalNumber

        public static boolean isNaturalNumber(Tensor tensor)
      • isNumeric

        public static boolean isNumeric(Tensor tensor)
      • isNegativeNaturalNumber

        public static boolean isNegativeNaturalNumber(Tensor tensor)
      • isPositiveNaturalNumber

        public static boolean isPositiveNaturalNumber(Tensor tensor)
      • isRealPositiveNumber

        public static boolean isRealPositiveNumber(Tensor tensor)
      • isRealNegativeNumber

        public static boolean isRealNegativeNumber(Tensor tensor)
      • isIndexless

        public static boolean isIndexless(Tensor... tensors)
      • isScalar

        public static boolean isScalar(Tensor... tensors)
      • isSymbol

        public static boolean isSymbol(Tensor t)
      • isSymbolOrNumber

        public static boolean isSymbolOrNumber(Tensor t)
      • isSymbolic

        public static boolean isSymbolic(Tensor t)
      • isSymbolic

        public static boolean isSymbolic(Tensor... tensors)
      • isOne

        public static boolean isOne(Tensor tensor)
      • isZero

        public static boolean isZero(Tensor tensor)
      • isImageOne

        public static boolean isImageOne(Tensor tensor)
      • isMinusOne

        public static boolean isMinusOne(Tensor tensor)
      • isIntegerOdd

        public static boolean isIntegerOdd(Tensor tensor)
      • isIntegerEven

        public static boolean isIntegerEven(Tensor tensor)
      • isPositiveIntegerPower

        public static boolean isPositiveIntegerPower(Tensor t)
        Returns true, if specified tensor is a^(N), where N - a natural number
        Parameters:
        t - tensor
        Returns:
        true, if specified tensor is a^(N), where N - a natural number
      • isPositiveIntegerPowerOfSimpleTensor

        public static boolean isPositiveIntegerPowerOfSimpleTensor(Tensor t)
        Returns true, if specified tensor is a^(N), where N - a natural number and a - is a simple tensor
        Parameters:
        t - tensor
        Returns:
        true, if specified tensor is a^(N), where N - a natural number and a - is a simple tensor
      • isPositiveIntegerPowerOfProduct

        public static boolean isPositiveIntegerPowerOfProduct(Tensor t)
        Returns true, if specified tensor is a^(N), where N - a natural number and a - is a product of tensors
        Parameters:
        t - tensor
        Returns:
        true, if specified tensor is a^(N), where N - a natural number and a - is a product of tensors
      • isNegativeIntegerPower

        public static boolean isNegativeIntegerPower(Tensor t)
        Returns true, if specified tensor is a^(-N), where N - a natural number
        Parameters:
        t - tensor
        Returns:
        true, if specified tensor is a^(-N), where N - a natural number
      • passOutDummies

        public static boolean passOutDummies(Tensor tensor)
        Returns true if tensor contains dummy indices.
        Parameters:
        tensor - tensor
        Returns:
        true if tensor contains dummy indices
      • containsSimpleTensors

        public static boolean containsSimpleTensors(Tensor tensor,
                                                    TIntSet setOfNames)
        Returns whether specified tensor contains at least one of the simple tensors from the set. The set represents a unique names of simple tensors.
        Parameters:
        tensor - tensors
        setOfNames - int set of simple tensors names
        Returns:
        true if tensor contains at least one of simple tensor with name that contains in the set
      • equalsExactly

        public static boolean equalsExactly(Tensor[] u,
                                            Tensor[] v)
      • equalsExactly

        public static boolean equalsExactly(Tensor u,
                                            java.lang.String v)
      • equalsExactly

        public static boolean equalsExactly(Tensor u,
                                            Tensor v)
      • getAllDummyIndicesT

        public static TIntHashSet getAllDummyIndicesT(Tensor tensor)
      • getAllDummyIndicesIncludingScalarFunctionsT

        public static TIntHashSet getAllDummyIndicesIncludingScalarFunctionsT(Tensor tensor)
      • getAllIndicesNamesT

        public static TIntHashSet getAllIndicesNamesT(java.util.Collection<? extends Tensor> tensors)
      • getAllIndicesNamesT

        public static TIntHashSet getAllIndicesNamesT(Tensor... tensors)
      • appendAllIndicesNamesT

        public static void appendAllIndicesNamesT(Tensor tensor,
                                                  TIntHashSet set)
      • appendAllIndicesNamesIncludingScalarFunctionsT

        public static void appendAllIndicesNamesIncludingScalarFunctionsT(Tensor tensor,
                                                                          TIntHashSet set)
      • equals

        public static boolean equals(Tensor u,
                                     Tensor v)
        Returns true if tensor u mathematically (not programming) equals to tensor v.
        Parameters:
        u - tensor
        v - tensor
        Returns:
        true if specified tensors are mathematically (not programming) equal
      • compare1

        public static java.lang.Boolean compare1(Tensor u,
                                                 Tensor v)
        Returns true if tensor u mathematically (not programming) equals to tensor v, false if they they differ only in the sign and null otherwise.
        Parameters:
        u - tensor
        v - tensor
        Returns:
        true true if tensor u mathematically (not programming) equals to tensor v, false if they they differ only in the sign and null otherwise
      • assertIndicesConsistency

        public static void assertIndicesConsistency(Tensor t)
      • isZeroDueToSymmetry

        public static boolean isZeroDueToSymmetry(Tensor t)
        Returns true if specified tensor is zero in consequence of its symmetries: is both symmetric and asymmetric with respect to some permutation at the same time.
        Parameters:
        t - tensor
        Returns:
        true if specified tensor is zero in consequence of its symmetries
      • getSymmetryFromMapping

        public static Permutation getSymmetryFromMapping(int[] indices,
                                                         Mapping mapping)
      • getSymmetriesFromMappings

        public static java.util.List<Permutation> getSymmetriesFromMappings(int[] indices,
                                                                            MappingsPort mappingsPort)
      • findIndicesSymmetries

        public static java.util.List<Permutation> findIndicesSymmetries(int[] indices,
                                                                        Tensor tensor)
      • getIndicesSymmetriesForIndicesWithSameStates

        public static java.util.List<Permutation> getIndicesSymmetriesForIndicesWithSameStates(int[] indices,
                                                                                               Tensor tensor)
      • getAllSymbols

        public static java.util.Set<SimpleTensor> getAllSymbols(Tensor... tensors)
      • getAllSymbolsAndSymbolicFields

        public static java.util.Set<SimpleTensor> getAllSymbolsAndSymbolicFields(Tensor... tensors)
      • getAllDiffSimpleTensors

        public static java.util.Collection<SimpleTensor> getAllDiffSimpleTensors(Tensor... tensors)
      • getAllNamesOfSymbols

        public static TIntHashSet getAllNamesOfSymbols(Tensor... tensors)
      • treeDepth

        public static int treeDepth(Tensor tensor)
      • det

        public static Tensor det(Tensor[][] matrix)
        Gives a determinant of matrix.
        Parameters:
        matrix - matrix
        Returns:
        determinant
      • containsFractions

        public static boolean containsFractions(Tensor tensor)
      • shareSimpleTensors

        public static boolean shareSimpleTensors(Tensor a,
                                                 Tensor b)
      • generateReplacementsOfScalars

        public static Expression[] generateReplacementsOfScalars(Tensor tensor)
        Generates a set of replacement rules for all scalar (but not symbolic) sub-tensors appearing in the specified tensor.
        Parameters:
        tensor - tensor
        Returns:
        set of replacement rules for all scalar (but not symbolic) sub-tensors appearing in the specified tensor
      • generateReplacementsOfScalars

        public static Expression[] generateReplacementsOfScalars(Tensor tensor,
                                                                 OutputPort<SimpleTensor> generatedCoefficients)
        Generates a set of replacement rules for all scalar (but not symbolic) sub-tensors appearing in the specified tensor.
        Parameters:
        tensor - tensor
        generatedCoefficients - allows to control how coefficients are generated
        Returns:
        set of replacement rules for all scalar (but not symbolic) sub-tensors appearing in the specified tensor
        See Also:
        LocalSymbolsProvider

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.