private static Tensor[][] parse2(String[][] momentums) { final Tensor[][] tt = new Tensor[momentums.length][]; int j; for (int i = 0; i < tt.length; ++i) { tt[i] = new Tensor[momentums[i].length]; for (j = 0; j < tt[i].length; ++j) tt[i][j] = parse(momentums[i][j]); } return tt; }
Flat = (Expression) Tensors.parse(Flat_, termIndicesInsertion); WR = (Expression) Tensors.parse(WR_, termIndicesInsertion); SR = (Expression) Tensors.parse(SR_, termIndicesInsertion); SSR = (Expression) Tensors.parse(SSR_, termIndicesInsertion); FF = (Expression) Tensors.parse(FF_, termIndicesInsertion); FR = (Expression) Tensors.parse(FR_, termIndicesInsertion); RR = (Expression) Tensors.parse(RR_, termIndicesInsertion); ACTION = (Expression) Tensors.parse(ACTION_, termIndicesInsertion); Expression[] terms = new Expression[]{Flat, WR, SR, SSR, FF, FR, RR}; DELTA_1 = (Expression) Tensors.parse(DELTA_1_, deltaIndicesInsertion); DELTA_2 = (Expression) Tensors.parse(DELTA_2_, deltaIndicesInsertion); DELTA_3 = (Expression) Tensors.parse(DELTA_3_, deltaIndicesInsertion); DELTA_4 = (Expression) Tensors.parse(DELTA_4_, deltaIndicesInsertion); Expression[] deltaExpressions = new Expression[]{DELTA_1, DELTA_2, DELTA_3, DELTA_4}; Expression kronecker = (Expression) Tensors.parse("d_{l}^{l}=4"); Transformation n2 = new SqrSubs(Tensors.parseSimple("n_l")), n2Transformer = new Transformer(TraverseState.Leaving, new Transformation[]{n2}); Transformation[] common = new Transformation[]{EliminateMetricsTransformation.ELIMINATE_METRICS, n2Transformer, kronecker}; Tensors.parse("HATK^{lma}", deltaIndicesInsertion), Tensors.parse("HATK^{lm}*HATK^{a}", deltaIndicesInsertion), Tensors.parse("HATK^{a}*HATK^{lm}", deltaIndicesInsertion), Tensors.parse("HATK^{l}*HATK^{m}*HATK^{a}", deltaIndicesInsertion) }; calculatedCombinations = new Expression[combinations.length]; Tensors.parse("HATK^{lmab}", deltaIndicesInsertion), Tensors.parse("HATK^{lma}*HATK^{b}", deltaIndicesInsertion),
this.L = Tensors.expression(Tensors.parse("L"), new Complex(operatorOrder)); this.hatQuantities = new Expression[HAT_QUANTITIES_GENERAL_COUNT][]; this.matrixIndicesCount = inputValues[1].get(0).getIndices().size() - operatorOrder; sb.append("*n").append(IndicesUtils.toString(IndicesUtils.inverseIndexState(covariantIndices[k]), OutputFormat.Redberry)); temp = Tensors.parse(sb.toString(), insertion); temp = inputValues[0].transform(temp); temp = inputValues[i + 1].transform(temp); sb = new StringBuilder(); sb.append(getStringHatQuantitieName(i)).append("=0"); hatQuantities[i][0] = (Expression) Tensors.parse(sb.toString(), insertion); for (k = 0; k < i; ++k) sb.append("*n").append(IndicesUtils.toString(IndicesUtils.inverseIndexState(covariantIndices[k]), OutputFormat.Redberry)); temp = Tensors.parse(sb.toString()); temp = inputValues[0].transform(temp); temp = inputValues[1].transform(temp); append("=iK*F"). append(covariantIndicesString); Tensor HATF = Tensors.parse(sb.toString(), insertion);
protected static Tensor defaultDimension() { return parse("4"); } }
/** * Converts array of string expressions into array of tensors. * * @param expressions array of strings to be parsed * @return array of parsed tensors * @throws cc.redberry.core.parser.ParserException if expression does not satisfy correct Redberry * input notation for tensors */ public static Tensor[] parse(final String... expressions) { Tensor[] r = new Tensor[expressions.length]; for (int i = 0; i < expressions.length; ++i) r[i] = parse(expressions[i]); return r; }
/** * Converts a string into {@link Expression}. * * @param expression string to be parsed * @return simple tensor * @throws IllegalArgumentException if string expression does not represents {@link Expression} * @throws cc.redberry.core.parser.ParserException if expression does not satisfy correct Redberry * input notation for tensors */ public static Expression parseExpression(String expression) { Tensor t = parse(expression); if (!(t instanceof Expression)) throw new IllegalArgumentException("Input tensor is not Expression."); return (Expression) t; }
/** * Converts a string into simple tensor. * * @param expression string to be parsed * @return simple tensor * @throws IllegalArgumentException if expression does not represents simple tensor * @throws cc.redberry.core.parser.ParserException if expression does not satisfy correct Redberry * input notation for tensors */ public static SimpleTensor parseSimple(String expression) { Tensor t = parse(expression); if (!(t instanceof SimpleTensor)) throw new IllegalArgumentException("Input tensor is not SimpleTensor."); return (SimpleTensor) t; }
public static boolean equalsExactly(Tensor u, String v) { return equalsExactly(u, Tensors.parse(v)); }
public Expression[] getNablaS() { if (operatorOrder < 1) return new Expression[0]; Expression[] nablaS = new Expression[getHatQuantities(1).length]; StringBuilder sb; for (int i = 0; i < nablaS.length; ++i) { sb = new StringBuilder().append("NABLAS_{l_{9}}").append(getHatQuantities(1)[i].get(0).getIndices().toString(OutputFormat.Redberry)).append("=0"); nablaS[i] = (Expression) Tensors.parse(sb.toString()); } return nablaS; }
@Override public Tensor create1(Tensor arg) { if (arg instanceof Cos) return arg.get(0); if (TensorUtils.isZero(arg)) return Tensors.parse("pi/2"); if (TensorUtils.isNumeric(arg)) return ComplexUtils.arccos((Complex) arg); return new ArcCos(arg); } }
@Override public Tensor create1(Tensor arg) { if (arg instanceof Cot) return arg.get(0); if (TensorUtils.isZero(arg)) return Tensors.parse("pi/2"); if (TensorUtils.isNumeric(arg)) return ComplexUtils.arccot((Complex) arg); return new ArcCot(arg); } }