Package ptolemy.math

Examples of ptolemy.math.Complex

@author Edward A. Lee, Jeff Tsay, Steve Neuendorffer, Adam Cataldo @version $Id: Complex.java,v 1.91 2007/12/06 21:57:08 cxh Exp $ @since Ptolemy II 0.2 @Pt.ProposedRating Yellow (eal) @Pt.AcceptedRating Red (cxh)

        System.out.println("\nCreate 1x3 cell array from ta, "
                + "an ArrayToken of RecordTokens:");

        RecordToken r1 = new RecordToken(new String[] { "a" },
                new Token[] { new ComplexMatrixToken(new Complex[][] { {
                        new Complex(1.0, 1.0), new Complex(2.0, 2.0) } }) });
        RecordToken r2 = new RecordToken(new String[] { "a" },
                new Token[] { new ComplexMatrixToken(new Complex[][] { {
                        new Complex(3.0, 3.0), new Complex(4.0, 4.0) } }) });
        RecordToken r3 = new RecordToken(new String[] { "a" },
                new Token[] { new ComplexMatrixToken(new Complex[][] { {
                        new Complex(5.0, 5.0), new Complex(6.0, 6.0) } }) });
        ta = new ArrayToken(new Token[] { r1, r2, r3 });
        System.out.println("ta = " + ta.toString());
        eng.put(engineHandle, "ta", ta);
        eng.evalString(engineHandle, "tb = ta;");
        ta = eng.get(engineHandle, "tb");
View Full Code Here


     *  of the Complex is the value of this token, the imaginary part
     *  is set to 0.
     @return A Complex.
     */
    public Complex complexValue() {
        return new Complex(_value);
    }
View Full Code Here

            Local tokenLocal = _buildConstantTokenLocal(body, insertPoint,
                    localName, doubleTokenClass, doubleTokenConstructor,
                    DoubleConstant.v(((DoubleToken) token).doubleValue()));
            return tokenLocal;
        } else if (token instanceof ComplexToken) {
            Complex complex = ((ComplexToken) token).complexValue();

            // ComplexToken takes a Complex as a constructor.
            SootClass complexClass = Scene.v().loadClassAndSupport(
                    "ptolemy.math.Complex");
            SootMethod complexConstructor = complexClass
View Full Code Here

            for (int colIndex = 0; colIndex < _colNum; colIndex++) {
                // Compute the distance for each possible path to "state".
                double d = 0.0;

                if (_mode == _TRELLIS) {
                    Complex y = ((ComplexToken) inputToken[0]).complexValue();
                    d = _computeTrellisDistance(y, _constellation,
                            _truthTable[state][colIndex][0]);
                } else if (_mode == _SOFT) {
                    double[] y = new double[inputRate];
View Full Code Here

     *  from the truth table.
     *  @return The distance.
     */
    private double _computeTrellisDistance(Complex y, Complex[] constellation,
            int truthValue) {
        Complex truthComplex = constellation[truthValue];

        //Complex z = y;
        Complex v = truthComplex.subtract(y);
        return v.magnitudeSquared();
    }
View Full Code Here

        double angleValue = ((DoubleToken) (angle.get(0))).doubleValue();

        double xValue = magnitudeValue * Math.cos(angleValue);
        double yValue = magnitudeValue * Math.sin(angleValue);

        output.send(0, new ComplexToken(new Complex(xValue, yValue)));
    }
View Full Code Here

    /** Returns a new ComplexToken with value 1.0.
     *  @return A new ComplexToken with value 1.0.
     */
    public Token one() {
        return new ComplexToken(new Complex(1.0));
    }
View Full Code Here

     *  that the type of the argument is an ComplexToken.
     *  @param rightArgument The token to add to this token.
     *  @return A new ComplexToken containing the result.
     */
    protected ScalarToken _add(ScalarToken rightArgument) {
        Complex result = _value.add(((ComplexToken) rightArgument)
                .complexValue());
        return new ComplexToken(result);
    }
View Full Code Here

     @return A new ComplexToken containing the result.
     *  @exception IllegalActionException Not thrown by this base class.
     */
    protected ScalarToken _divide(ScalarToken rightArgument)
            throws IllegalActionException {
        Complex result = _value.divide(((ComplexToken) rightArgument)
                .complexValue());
        return new ComplexToken(result);
    }
View Full Code Here

     *  the type of the argument is an ComplexToken.
     *  @param rightArgument The token to multiply this token by.
     *  @return A new ComplexToken containing the result.
     */
    protected ScalarToken _multiply(ScalarToken rightArgument) {
        Complex result = _value.multiply(((ComplexToken) rightArgument)
                .complexValue());
        return new ComplexToken(result);
    }
View Full Code Here

TOP

Related Classes of ptolemy.math.Complex

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.