public final class Tensors extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addAntiSymmetry(SimpleTensor tensor,
IndexType type,
int... permutation)
Attaches antisymmetry to simple tensor with respect to indices of specified type.
|
static void |
addAntiSymmetry(SimpleTensor tensor,
int... permutation)
Attaches antisymmetry to simple tensor.
|
static void |
addAntiSymmetry(String tensor,
IndexType type,
int... permutation)
Attaches antisymmetry to simple tensor with respect to indices of specified type.
|
static void |
addAntiSymmetry(String tensor,
int... permutation)
Attaches antisymmetry to simple tensor.
|
static void |
addSymmetries(SimpleTensor tensor,
Permutation... permutations)
Attaches symmetries to simple tensor.
|
static void |
addSymmetries(String tensor,
Permutation... permutations)
Attaches symmetris to simple tensor.
|
static void |
addSymmetry(SimpleTensor tensor,
IndexType type,
boolean sign,
int... permutation)
Attaches symmetry to simple tensor with respect to indices of specified type.
|
static void |
addSymmetry(SimpleTensor tensor,
IndexType type,
int... permutation)
Attaches symmetry to simple tensor with respect to indices of specified type.
|
static void |
addSymmetry(SimpleTensor tensor,
IndexType type,
Permutation permutation)
Attaches symmetry to simple tensor with respect to indices of specified type.
|
static void |
addSymmetry(SimpleTensor tensor,
int... permutation)
Attaches symmetry to simple tensor.
|
static void |
addSymmetry(SimpleTensor tensor,
Permutation permutation)
Attaches symmetry to simple tensor.
|
static void |
addSymmetry(String tensor,
IndexType type,
boolean sign,
int... permutation)
Attaches symmetry to simple tensor with respect to indices of specified type.
|
static void |
addSymmetry(String tensor,
IndexType type,
int... permutation)
Attaches symmetry to simple tensor with respect to indices of specified type.
|
static void |
addSymmetry(String tensor,
IndexType type,
Permutation permutation)
Attaches symmetry to simple tensor with respect to indices of specified type.
|
static void |
addSymmetry(String tensor,
int... permutation)
Attaches symmetry to simple tensor.
|
static void |
addSymmetry(String tensor,
Permutation permutation)
Attaches symmetry to simple tensor.
|
static Tensor |
arccos(Tensor argument)
Creates a arccosine object from scalar argument.
|
static Tensor |
arccot(Tensor argument)
Creates a arcotangent object from scalar argument.
|
static Tensor |
arcsin(Tensor argument)
Creates a arcsinus object from scalar argument.
|
static Tensor |
arctan(Tensor argument)
Creates a arctangent object from scalar argument.
|
static Tensor |
cos(Tensor argument)
Creates a cosine object from scalar argument.
|
static Tensor |
cot(Tensor argument)
Creates a cotangent object from scalar argument.
|
static SimpleTensor |
createKronecker(int index1,
int index2)
Returns Kronecker tensor with specified upper and lower indices.
|
static SimpleTensor |
createMetric(int index1,
int index2)
Returns metric tensor with specified indices.
|
static SimpleTensor |
createMetricOrKronecker(int index1,
int index2)
Returns metric tensor if specified indices have same states and
Kronecker tensor if specified indices have different states.
|
static Tensor |
divide(Tensor a,
Tensor b)
Returns
a divided by b. |
static Tensor |
exp(Tensor argument)
Creates a exponent object from scalar argument.
|
static Expression |
expression(Tensor left,
Tensor right)
Creates an expression object from two tensors.
|
static TensorField |
field(int name,
SimpleIndices indices,
SimpleIndices[] argIndices,
Tensor[] arguments)
Returns new tensor field with specified int name (see
NameManager
for details), indices, arguments list and explicit argument indices
bindings. |
static TensorField |
field(int name,
SimpleIndices indices,
Tensor[] arguments)
Returns new tensor field with specified int name (see
NameManager
for details), indices and arguments list. |
static TensorField |
field(String name,
SimpleIndices indices,
SimpleIndices[] argIndices,
Tensor[] arguments)
Returns new tensor field with specified string name, indices, arguments
list and explicit argument indices bindings.
|
static TensorField |
field(String name,
SimpleIndices indices,
Tensor[] arguments)
Returns new tensor field with specified string name, indices and
arguments list.
|
static TensorField |
fieldDerivative(String name,
SimpleIndices indices,
SimpleIndices[] argIndices,
Tensor[] arguments,
int[] orders)
Returns new tensor field derivative with specified string name, indices, arguments, derivative orders and
explicit argument indices bindings.
|
static TensorField |
fieldDerivative(TensorField parent,
SimpleIndices derivativeIndices,
int argPosition)
Creates 1-st derivative with respect to specified argument of specified tensor field with specified derivative
indices
|
static TensorField |
fieldDerivative(TensorField parent,
SimpleIndices derivativeIndices,
int argPosition,
int order)
Creates n-th derivative with respect to specified argument of specified tensor field with specified derivative
indices
|
static boolean |
isKronecker(Tensor t)
Returns
true if specified tensor is Kronecker tensor |
static boolean |
isKroneckerOrMetric(SimpleTensor t)
Returns
true if specified tensor is metric or Kronecker tensor |
static boolean |
isKroneckerOrMetric(Tensor t)
Returns
true if specified tensor is metric or Kronecker tensor |
static boolean |
isMetric(Tensor t)
Returns
true if specified tensor is metric tensor |
static Tensor |
log(Tensor argument)
Creates a natural logarithm object from scalar argument.
|
static Tensor |
multiply(Tensor... factors)
Returns the result of multiplication of specified tensors.
|
static Tensor |
multiplyAndRenameConflictingDummies(Tensor... factors)
Returns result of multiplication of specified tensors taking care about
all conflicting dummy indices in factors.
|
static Tensor |
negate(Tensor tensor)
Multiplies specified tensor by minus one.
|
static Tensor[] |
parse(String... expressions)
Converts array of string expressions into array of tensors.
|
static Tensor |
parse(String expression)
Converts string expression into tensor.
|
static Tensor |
parse(String expression,
ParseTokenTransformer... preprocessors)
Converts string expression into tensor, additionally transforming AST according to specified
AST transformers.
|
static Expression |
parseExpression(String expression)
Converts a string into
Expression. |
static SimpleTensor |
parseSimple(String expression)
Converts a string into simple tensor.
|
static Tensor |
pow(Tensor argument,
BigInteger power)
Power function.
|
static Tensor |
pow(Tensor argument,
int power)
Power function.
|
static Tensor |
pow(Tensor argument,
Tensor power)
Power function.
|
static Tensor |
reciprocal(Tensor tensor)
Returns reciprocal of the specified tensor, i.e.
|
static void |
resolveAllDummies(Tensor[] factors) |
static Tensor[] |
resolveDummy(Tensor[] factors)
Renames dummies in specified tensors, such that it becomes safe to multiply them.
|
static void |
setAntiSymmetric(Object... tensors)
Makes simple tensors antisymmetric.
|
static void |
setAntiSymmetric(SimpleTensor tensor)
Makes simple tensor antisymmetric.
|
static void |
setAntiSymmetric(SimpleTensor tensor,
IndexType type)
Makes simple tensor antisymmetric with respect to indices of specified type.
|
static void |
setAntisymmetric(String... tensors)
Makes simple tensors symmetric.
|
static void |
setAntiSymmetric(String tensor)
Makes simple tensor antisymmetric.
|
static SimpleTensor |
setIndices(SimpleTensor tensor,
int[] indices)
Returns an instance of specified simple tensor with specified indices
|
static SimpleTensor |
setIndices(SimpleTensor tensor,
SimpleIndices indices)
Returns an instance of specified simple tensor with specified indices
|
static void |
setSymmetric(Object... tensors)
Makes simple tensors symmetric.
|
static void |
setSymmetric(SimpleTensor tensor)
Makes simple tensor symmetric.
|
static void |
setSymmetric(SimpleTensor tensor,
IndexType type)
Makes simple tensor symmetric with respect to indices of specified type.
|
static void |
setSymmetric(String tensor)
Makes simple tensor symmetric.
|
static SimpleTensor |
simpleTensor(int name,
SimpleIndices indices)
Returns new simple tensor with specified int name (see
NameManager
for details) and indices. |
static SimpleTensor |
simpleTensor(String name,
SimpleIndices indices)
Returns new simple tensor with specified string name and indices.
|
static Tensor |
sin(Tensor argument)
Creates a sinus object from scalar argument.
|
static Tensor |
subtract(Tensor a,
Tensor b)
Subtracts
b from a |
static Tensor |
sum(Tensor... tensors)
Returns the result of summation of several tensors.
|
static Tensor |
tan(Tensor argument)
Creates a tangent object from scalar argument
|
public static Tensor pow(Tensor argument, int power)
argument - basepower - powerIllegalArgumentException - if argument is not scalarpublic static Tensor pow(Tensor argument, BigInteger power)
argument - basepower - powerIllegalArgumentException - if argument is not scalarpublic static Tensor pow(Tensor argument, Tensor power)
argument - basepower - powerIllegalArgumentException - if argument or power is not scalarpublic static Tensor multiply(Tensor... factors)
multiplyAndRenameConflictingDummies(Tensor...)
instead.factors - array of factors to be multipliedInconsistentIndicesException - if there is indices clashpublic static Tensor multiplyAndRenameConflictingDummies(Tensor... factors)
factors - array of factors to be multipliedInconsistentIndicesException - if there is indices clashpublic static Tensor[] resolveDummy(Tensor[] factors)
factors - tensorspublic static void resolveAllDummies(Tensor[] factors)
public static Tensor divide(Tensor a, Tensor b)
a divided by b.a - tensorb - scalar tensora divided by b.IllegalArgumentException - if b is not scalarpublic static Tensor sum(Tensor... tensors)
tensors - array of summandsTensorException - if tensors have different free indicespublic static Tensor subtract(Tensor a, Tensor b)
b from aa - tensorb - tensora - bTensorException - if tensors have different free indicespublic static Tensor negate(Tensor tensor)
tensor - tensor to be negotiatedpublic static Tensor reciprocal(Tensor tensor)
tensor - tensorIllegalArgumentException - if specified tensor is not scalarpublic static SimpleTensor simpleTensor(String name, SimpleIndices indices)
name - string name of the tensorindices - indicesSimpleTensor objectpublic static SimpleTensor simpleTensor(int name, SimpleIndices indices)
NameManager
for details) and indices.name - int name of the tensorindices - indicesSimpleTensor objectpublic static TensorField fieldDerivative(TensorField parent, SimpleIndices derivativeIndices, int argPosition)
parent - tensor fieldderivativeIndices - indices of the var (inverted)argPosition - argumentpublic static TensorField fieldDerivative(TensorField parent, SimpleIndices derivativeIndices, int argPosition, int order)
parent - tensor fieldderivativeIndices - indices of the var (inverted)argPosition - argumentorder - order of derivativepublic static TensorField fieldDerivative(String name, SimpleIndices indices, SimpleIndices[] argIndices, Tensor[] arguments, int[] orders)
name - string name of the corresponding tensor fieldindices - total indices of resulting derivative (field indices + indices of vars)argIndices - argument indices bindingsarguments - arguments listorders - orders of derivativesTensorField objectpublic static TensorField field(String name, SimpleIndices indices, Tensor[] arguments)
name - int name of the fieldindices - indicesarguments - arguments listTensorField objectpublic static TensorField field(String name, SimpleIndices indices, SimpleIndices[] argIndices, Tensor[] arguments)
name - int name of the fieldindices - indicesargIndices - argument indices bindingsarguments - arguments listTensorField objectpublic static TensorField field(int name, SimpleIndices indices, SimpleIndices[] argIndices, Tensor[] arguments)
NameManager
for details), indices, arguments list and explicit argument indices
bindings.name - int name of the fieldindices - indicesargIndices - argument indices bindingsarguments - arguments listTensorField objectpublic static TensorField field(int name, SimpleIndices indices, Tensor[] arguments)
NameManager
for details), indices and arguments list. Free indices of arguments
assumed as arguments indices bindings of this field bindings.name - int name of the fieldindices - indicesarguments - arguments listTensorField objectpublic static SimpleTensor setIndices(SimpleTensor tensor, int[] indices)
tensor - simple tensorindices - indicespublic static SimpleTensor setIndices(SimpleTensor tensor, SimpleIndices indices)
tensor - simple tensorindices - indicespublic static Expression expression(Tensor left, Tensor right)
left - left part of expressionright - right part of expressionExpressionpublic static Tensor sin(Tensor argument)
argument - scalar argument of sinuspublic static Tensor cos(Tensor argument)
argument - scalar argument of cosinepublic static Tensor tan(Tensor argument)
argument - scalar argument of tangentpublic static Tensor cot(Tensor argument)
argument - scalar argument of cotangentpublic static Tensor arcsin(Tensor argument)
argument - scalar argument of arcsinuspublic static Tensor arccos(Tensor argument)
argument - scalar argument of arccosinepublic static Tensor arctan(Tensor argument)
argument - scalar argument of arctangentpublic static Tensor arccot(Tensor argument)
argument - scalar argument of arccotangentpublic static Tensor log(Tensor argument)
argument - scalar argument of logarithmpublic static Tensor exp(Tensor argument)
argument - scalar argument of exponentpublic static SimpleTensor createKronecker(int index1, int index2)
index1 - first indexindex2 - second indexIllegalArgumentException - if indices have same statesIllegalArgumentException - if indices have different typespublic static SimpleTensor createMetric(int index1, int index2)
index1 - first indexindex2 - second indexIllegalArgumentException - if indices have different statesIllegalArgumentException - if indices have different typesIllegalArgumentException - if indices have non metric typespublic static SimpleTensor createMetricOrKronecker(int index1, int index2)
index1 - first indexindex2 - second indexIllegalArgumentException - if indices have different typesIllegalArgumentException - if indices have same states and non metric typespublic static boolean isKronecker(Tensor t)
true if specified tensor is Kronecker tensort - tensortrue if specified tensor is Kronecker tensorpublic static boolean isMetric(Tensor t)
true if specified tensor is metric tensort - tensortrue if specified tensor is metric tensorpublic static boolean isKroneckerOrMetric(Tensor t)
true if specified tensor is metric or Kronecker tensort - tensortrue if specified tensor is metric or Kronecker tensorpublic static boolean isKroneckerOrMetric(SimpleTensor t)
true if specified tensor is metric or Kronecker tensort - tensortrue if specified tensor is metric or Kronecker tensorpublic static Tensor parse(String expression)
expression - string to be parsedParserException - if expression does not satisfy correct Redberry
input notation for tensorspublic static Tensor[] parse(String... expressions)
expressions - array of strings to be parsedParserException - if expression does not satisfy correct Redberry
input notation for tensorspublic static Tensor parse(String expression, ParseTokenTransformer... preprocessors)
expression - string to be parsedpreprocessors - AST transformersParserException - if expression does not satisfy correct Redberry
input notation for tensorspublic static SimpleTensor parseSimple(String expression)
expression - string to be parsedIllegalArgumentException - if expression does not represents simple tensorParserException - if expression does not satisfy correct Redberry
input notation for tensorspublic static Expression parseExpression(String expression)
Expression.expression - string to be parsedIllegalArgumentException - if string expression does not represents ExpressionParserException - if expression does not satisfy correct Redberry
input notation for tensorspublic static void addSymmetry(String tensor, IndexType type, Permutation permutation)
tensor - string representation of simple tensortype - type of indicespermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if degree of permutation differs from the size of indices
of specified typepublic static void addSymmetry(SimpleTensor tensor, IndexType type, Permutation permutation)
tensor - simple tensortype - type of indicespermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified typepublic static void addSymmetry(SimpleTensor tensor, Permutation permutation)
tensor - simple tensorpermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified tensorpublic static void addSymmetry(String tensor, Permutation permutation)
tensor - string representation of simple tensorpermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified tensorpublic static void addSymmetries(SimpleTensor tensor, Permutation... permutations)
tensor - simple tensorpermutations - permutationsIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if degree of some permutation differs from the size of indices
of specified tensorpublic static void addSymmetries(String tensor, Permutation... permutations)
tensor - string representation of simple tensorpermutations - permutationsIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if degree of some permutation differs from the size of indices
of specified tensorpublic static void addSymmetry(String tensor, IndexType type, boolean sign, int... permutation)
tensor - string representation of simple tensorpermutation - permutationsign - true for antisymmetry, false for symmetrytype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if order of specified permutation is odd and sign is trueIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified typepublic static void addSymmetry(SimpleTensor tensor, IndexType type, boolean sign, int... permutation)
tensor - simple tensorpermutation - permutationsign - true for antisymmetry, false for symmetrytype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if order of specified permutation is odd and sign is trueIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified typepublic static void addSymmetry(String tensor, IndexType type, int... permutation)
tensor - string representation of simple tensorpermutation - permutationtype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified typepublic static void addSymmetry(SimpleTensor tensor, IndexType type, int... permutation)
tensor - simple tensorpermutation - permutationtype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified typepublic static void addAntiSymmetry(String tensor, IndexType type, int... permutation)
tensor - string representation of simple tensorpermutation - permutationtype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if order of specified permutation is oddIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified typepublic static void addAntiSymmetry(SimpleTensor tensor, IndexType type, int... permutation)
tensor - simple tensorpermutation - permutationtype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if order of specified permutation is oddIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified typepublic static void addSymmetry(String tensor, int... permutation)
tensor - string representation of simple tensorpermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified tensorpublic static void addSymmetry(SimpleTensor tensor, int... permutation)
tensor - simple tensorpermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified tensorpublic static void addAntiSymmetry(String tensor, int... permutation)
tensor - string representation of simple tensorpermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if order of specified permutation is oddIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified tensorpublic static void addAntiSymmetry(SimpleTensor tensor, int... permutation)
tensor - simple tensorpermutation - permutationIllegalStateException - if this tensor is already in use (it's permutation group calculated)IllegalArgumentException - if specified permutation is inconsistent with one-line notationIllegalArgumentException - if order of specified permutation is oddIllegalArgumentException - if degree of specified permutation differs from the size of indices
of specified tensorpublic static void setAntiSymmetric(SimpleTensor tensor, IndexType type)
tensor - simple tensortype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setAntiSymmetric(SimpleTensor tensor)
tensor - simple tensorIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setAntiSymmetric(String tensor)
tensor - string representation of simple tensorIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setAntiSymmetric(Object... tensors)
tensors - string representation of simple tensorIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setSymmetric(SimpleTensor tensor, IndexType type)
tensor - simple tensortype - type of indicesIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setSymmetric(SimpleTensor tensor)
tensor - simple tensorIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setSymmetric(String tensor)
tensor - string representation of simple tensorIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setSymmetric(Object... tensors)
tensors - string representation of simple tensorsIllegalStateException - if this tensor is already in use (it's permutation group calculated)public static void setAntisymmetric(String... tensors)
tensors - string representation of simple tensorsIllegalStateException - if this tensor is already in use (it's permutation group calculated)Copyright © 2014. All Rights Reserved.