Package cc.redberry.core.number

Examples of cc.redberry.core.number.Rational


        List<Tensor> toMultiply = new ArrayList<>(map.size());
        for (SortedMap.Entry<GenPolynomial<BigInteger>, Long> entry : map.entrySet())
            toMultiply.add(Tensors.pow(poly2Tensor(entry.getKey(), varsArray),
                    new Complex(entry.getValue())));
        if (!gcd.equals(java.math.BigInteger.ONE) || !lcm.equals(java.math.BigInteger.ONE))
            toMultiply.add(new Complex(new Rational(gcd, lcm)));

        return Tensors.multiply(toMultiply.toArray(new Tensor[toMultiply.size()]));
    }
View Full Code Here


        for (Monomial<BigInteger> monomial : poly) {
            coefficient = monomial.coefficient();
            exp = monomial.exponent();
            temp.clear();

            temp.add(new Complex(new Rational(coefficient.getVal())));
            for (int i = 0; i < exp.length(); ++i)
                if ((lExp = exp.getVal(i)) != 0)
                    temp.add(Tensors.pow(varsArray[i].simpleTensor, new Complex(lExp)));

            sum.add(Tensors.multiply(temp.toArray(new Tensor[temp.size()])));
View Full Code Here

        List<Tensor> toMultiply = new ArrayList<>(map.size());
        for (SortedMap.Entry<GenPolynomial<BigInteger>, Long> entry : map.entrySet())
            toMultiply.add(Tensors.pow(poly2Tensor(entry.getKey(), varsArray),
                    new Complex(entry.getValue())));
        if (!gcd.equals(java.math.BigInteger.ONE) || !lcm.equals(java.math.BigInteger.ONE))
            toMultiply.add(new Complex(new Rational(gcd, lcm)));

        return Tensors.multiply(toMultiply.toArray(new Tensor[toMultiply.size()]));
    }
View Full Code Here

        for (Monomial<BigInteger> monomial : poly) {
            coefficient = monomial.coefficient();
            exp = monomial.exponent();
            temp.clear();

            temp.add(new Complex(new Rational(coefficient.getVal())));
            for (int i = 0; i < exp.length(); ++i)
                if ((lExp = exp.getVal(i)) != 0)
                    temp.add(Tensors.pow(varsArray[i].simpleTensor, new Complex(lExp)));

            sum.add(Tensors.multiply(temp.toArray(new Tensor[temp.size()])));
View Full Code Here

                assert factor.equals(tempF);
            }

            if (!factor.isOne())
                temp = FastTensors.multiplySumElementsOnFactor((Sum) temp, factor.reciprocal());
            return multiply(new Complex(new Rational(1, temp.size())), temp);
        }
        return temp;
    }
View Full Code Here

                        new Mapping(indices, symmetry.permute(indices), symmetry.isAntiSymmetry())));
                ++length;
            }
            t = sb.build();
            if (t instanceof Sum)
                return FastTensors.multiplySumElementsOnFactor((Sum) t, new Complex(new Rational(1L, length)));
            return Tensors.multiply(new Complex(new Rational(1L, length)), t);
        }
    }
View Full Code Here

                if (summand != null)
                    sumBuilder.put(summand);
            }
        }
        if (multiplyOnSymmetryFactor)
            return Tensors.multiply(new Complex(new Rational(1, generatedPermutations.size())), sumBuilder.build());
        else
            return sumBuilder.build();
    }
View Full Code Here

        List<Tensor> toMultiply = new ArrayList<>(map.size());
        for (SortedMap.Entry<GenPolynomial<BigInteger>, Long> entry : map.entrySet())
            toMultiply.add(Tensors.pow(poly2Tensor(entry.getKey(), varsArray),
                    new Complex(entry.getValue())));
        if (!gcd.equals(java.math.BigInteger.ONE) || !lcm.equals(java.math.BigInteger.ONE))
            toMultiply.add(new Complex(new Rational(gcd, lcm)));

        return Tensors.multiply(toMultiply.toArray(new Tensor[toMultiply.size()]));
    }
View Full Code Here

        for (Monomial<BigInteger> monomial : poly) {
            coefficient = monomial.coefficient();
            exp = monomial.exponent();
            temp.clear();

            temp.add(new Complex(new Rational(coefficient.getVal())));
            for (int i = 0; i < exp.length(); ++i)
                if ((lExp = exp.getVal(i)) != 0)
                    temp.add(Tensors.pow(varsArray[i].simpleTensor, new Complex(lExp)));

            sum.add(Tensors.multiply(temp.toArray(new Tensor[temp.size()])));
View Full Code Here

                if (withCoefficients) {
                    coefficient = CC.generateNewSymbol();
                    coefficients.add((SimpleTensor) coefficient);
                } else coefficient = Complex.ONE;

                term = Tensors.multiply(coefficient, term, term instanceof Sum ? new Complex(new Rational(1, term.size())) : Complex.ONE);
            } else if (withCoefficients)
                term = FastTensors.multiplySumElementsOnFactors((Sum) term);
            result.put(term);
        }
        this.result = (symmetries == null || symmetries.isEmpty()) ? result.build() : symmetrize(result.build(), symmetries);
View Full Code Here

TOP

Related Classes of cc.redberry.core.number.Rational

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.