cc.redberry.core.context
Class CC
- java.lang.Object
-
- cc.redberry.core.context.CC
-
public final class CC extends java.lang.ObjectRedberry current context. This class statically delegates common useful methods from Redberry context of current session.- Since:
- 1.0
- See Also:
Context
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static Contextcurrent()Returns the current context of Redberry session.static SimpleTensorgenerateNewSymbol()Generates a new symbol which never used before during current session.static OutputFormatgetDefaultOutputFormat()Returns current default output format.static IndexConverterManagergetIndexConverterManager()Returns index converter manager of current session.static java.util.Set<IndexType>getMatrixTypes()Returns all matrix types.static java.util.Set<IndexType>getMetricTypes()Returns all metric types.static NameDescriptorgetNameDescriptor(int name)ReturnsNameDescriptorcorresponding to the specifiedintnameId.static NameManagergetNameManager()Returns the name manager (namespace) of current session.static OutputPort<SimpleTensor>getParametersGenerator()Return output port which generates new symbol viagenerateNewSymbol()at eachtake()invocation.static org.apache.commons.math3.random.RandomGeneratorgetRandomGenerator()Returns random generator used by Redberry in current session.static booleanisMetric(byte type)Returns true if metric is defined for specified index type.static booleanisMetric(IndexType type)Returns true if metric is defined for specified index type.static voidresetTensorNames()This method resets all tensor names in the namespace.static voidresetTensorNames(long seed)This method resets all tensor names in the namespace and sets a specified seed to theNameManager.static voidsetDefaultOutputFormat(OutputFormat defaultOutputFormat)Sets the default output format.
-
-
-
Method Detail
-
current
public static Context current()
Returns the current context of Redberry session.- Returns:
- the current context of Redberry session.
-
isMetric
public static boolean isMetric(byte type)
Returns true if metric is defined for specified index type.- Parameters:
type- index type- Returns:
- true if metric is defined for specified index type
-
isMetric
public static boolean isMetric(IndexType type)
Returns true if metric is defined for specified index type.- Parameters:
type- index type- Returns:
- true if metric is defined for specified index type
-
getNameDescriptor
public static NameDescriptor getNameDescriptor(int name)
ReturnsNameDescriptorcorresponding to the specifiedintnameId.- Parameters:
name- integer name of tensor- Returns:
- corresponding
NameDescriptor
-
getNameManager
public static NameManager getNameManager()
Returns the name manager (namespace) of current session.- Returns:
- the name manager (namespace) of current session.
-
getIndexConverterManager
public static IndexConverterManager getIndexConverterManager()
Returns index converter manager of current session.- Returns:
- index converter manager of current session
-
getDefaultOutputFormat
public static OutputFormat getDefaultOutputFormat()
Returns current default output format.- Returns:
- current default output format
-
getMetricTypes
public static java.util.Set<IndexType> getMetricTypes()
Returns all metric types.- Returns:
- all metric types
-
getMatrixTypes
public static java.util.Set<IndexType> getMatrixTypes()
Returns all matrix types.- Returns:
- all matrix types
-
setDefaultOutputFormat
public static void setDefaultOutputFormat(OutputFormat defaultOutputFormat)
Sets the default output format.After this step, all expressions will be printed according to the specified output format.
- Parameters:
defaultOutputFormat- output format
-
resetTensorNames
public static void resetTensorNames()
This method resets all tensor names in the namespace.Any tensor created before this method call becomes invalid, and must not be used! This method is mainly used in unit tests, so avoid invocations of this method in general computations.
-
resetTensorNames
public static void resetTensorNames(long seed)
This method resets all tensor names in the namespace and sets a specified seed to theNameManager. If this method is invoked with constant seed before any interactions with Redberry, further behaviour of Redberry will be fully deterministic from run to run (order of summands and multipliers will be fixed, computation time will be pretty constant, hash codes will be the same).Any tensor created before this method call becomes invalid, and must not be used! This method is mainly used in unit tests, so avoid invocations of this method in general computations.
-
generateNewSymbol
public static SimpleTensor generateNewSymbol()
Generates a new symbol which never used before during current session.- Returns:
- new symbol which never used before during current session
-
getParametersGenerator
public static OutputPort<SimpleTensor> getParametersGenerator()
Return output port which generates new symbol viagenerateNewSymbol()at eachtake()invocation.- Returns:
- output port which generates new symbol via
generateNewSymbol()at eachtake()invocation.
-
getRandomGenerator
public static org.apache.commons.math3.random.RandomGenerator getRandomGenerator()
Returns random generator used by Redberry in current session.- Returns:
- random generator used by Redberry in current session
-
-
DataMelt 3.0 © DataMelt by jWork.ORG