Documentation of 'cc.redberry.core.tensor.Product' Java class
Product
cc.redberry.core.tensor

Class Product

  • All Implemented Interfaces:
    java.lang.Comparable<Tensor>, java.lang.Iterable<Tensor>


    public final class Product
    extends MultiTensor
    Representation of product of mathematical expressions.

    The implementation keeps numerical factor, indexless multipliers, and multipliers with non empty free indices separately. If there is no numeric factor in product, it is equal to 1. Bot indexless and indexed data are sorted according to Tensor.compareTo(Tensor) method. Indexed data is additionally sorted according to a special comparator based on StructureOfContractions of this product.

    Since:
    1.0
    • Method Detail

      • getIndices

        public Indices getIndices()
        Description copied from class: Tensor
        Returns indices of this tensor.
        Overrides:
        getIndices in class MultiTensor
        Returns:
        indices of this tensor
      • get

        public Tensor get(int i)
        Description copied from class: Tensor
        Returns element at i-th position.
        Specified by:
        get in class Tensor
        Parameters:
        i - position
        Returns:
        element at i-th position
      • getRange

        public Tensor[] getRange(int from,
                                 int to)
        Description copied from class: Tensor
        Retrieves several sub-tensors from current tensor. This function is faster than sequential invocations of Tensor.get(int) method.
        Overrides:
        getRange in class Tensor
        Parameters:
        from - index of first sub-tensor to be retrieved (inclusive)
        to - next index after last sub-tensor to be retrieved (exclusive)
        Returns:
        array with retrieved tensors
      • size

        public int size()
        Description copied from class: Tensor
        Returns the number of elements in this tensor.
        Specified by:
        size in class Tensor
        Returns:
        the number of elements in this tensor
      • sizeWithoutFactor

        public int sizeWithoutFactor()
        Returns the size of product without factor. I.e. if factor is one, then sizeWithoutFactor() == size(), otherwise sizeWithoutFactor() == size() - 1.
        Returns:
        size of product without factor
      • sizeOfIndexlessPart

        public int sizeOfIndexlessPart()
        Returns the size of indexless part (including numerical factor).
        Returns:
        size of indexless part (including numerical factor)
      • set

        public Tensor set(int i,
                          Tensor tensor)
        Description copied from class: Tensor
        Returns new tensor instance with i-th sub-tensor replaced by provided tensor.
        Overrides:
        set in class Tensor
        Parameters:
        i - index of sub-tensor to be replaced
        tensor - tensor to replace i-th sub-tensor
        Returns:
        new instance of tensor
      • remove

        public Tensor remove(int position)
        Description copied from class: MultiTensor
        Removes tensor at the specified position and returns the result.
        Specified by:
        remove in class MultiTensor
        Parameters:
        position - position in tensor
        Returns:
        result of removing
      • getWithoutFactor

        public Tensor getWithoutFactor(int i)
        Returns element at i-th position excluding numerical factor of this product from numbering. So, if factor is one, then this method returns get(i), otherwise is returns get(i-1).
        Parameters:
        i - position
        Returns:
        element at i-th position excluding numerical factor of this product from numbering
      • getFactor

        public Complex getFactor()
        Returns numerical factor of this product.
        Returns:
        numerical factor of this product
      • getContent

        public ProductContent getContent()
        Returns the product content, i.e. the information about the corresponding graph.
        Returns:
        product content
      • getIndexless

        public Tensor[] getIndexless()
        Returns a copy of indexless data.
        Returns:
        a copy of indexless data
      • getAllScalars

        public Tensor[] getAllScalars()
        Returns all scalar factors in this product. For example, if this is 2*a*f_mn*G^mn*f_a*T^ab, the result will be [2,a,f_mn*G^mn].
        Returns:
        all scalar factors in this product
      • getAllScalarsWithoutFactor

        public Tensor[] getAllScalarsWithoutFactor()
        Returns all scalar factors in this product excluding the numerical factor. For example, if this is 2*a*f_mn*G^mn*f_a*T^ab, the result will be [a,f_mn*G^mn].
        Returns:
        all scalar factors in this product excluding the numerical factor
      • getIndexlessSubProduct

        public Tensor getIndexlessSubProduct()
        Returns indexless data as a product of tensors.
        Returns:
        indexless data as a product of tensors
      • getSubProductWithoutFactor

        public Tensor getSubProductWithoutFactor()
        Returns this product but without numeric factor.
        Returns:
        this product but without numeric factor
      • getDataSubProduct

        public Tensor getDataSubProduct()
        Returns the product of indexed (with non empty free indices) multipliers of this tensor.
        Returns:
        product of indexed (with non empty free indices) multipliers of this tensor
      • toString

        public java.lang.String toString(OutputFormat format)
        Description copied from class: Tensor
        Returns a string representation of a tensor according to the specified OutputFormat.
        Specified by:
        toString in class Tensor
        Parameters:
        format - output format
        Returns:
        a string representation of a tensor

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.