Package ptolemy.math

Examples of ptolemy.math.FixPoint$Error


        FixPoint[][] result = new FixPoint[_rowCount][convertedArgument._columnCount];

        for (int i = 0; i < _rowCount; i++) {
            for (int j = 0; j < convertedArgument._columnCount; j++) {
                FixPoint sum = _value[i][0]
                        .multiply(convertedArgument._value[0][j]);

                for (int k = 1; k < _columnCount; k++) {
                    sum = sum.add(_value[i][k]
                            .multiply(convertedArgument._value[k][j]));
                }

                result[i][j] = sum;
            }
View Full Code Here


     *  supported by the derived class.
     *  @return A new Token containing the result.
     */
    protected MatrixToken _multiplyElement(Token rightArgument)
            throws IllegalActionException {
        FixPoint scalar;
        if (rightArgument instanceof FixMatrixToken) {
            if (((FixMatrixToken) rightArgument).getRowCount() != 1
                    || ((FixMatrixToken) rightArgument).getColumnCount() != 1) {
                // Throw an exception.
                return super._moduloElement(rightArgument);
View Full Code Here

     *  supported by the derived class.
     *  @return A new Token containing the result.
     */
    protected MatrixToken _subtractElement(Token rightArgument)
            throws IllegalActionException {
        FixPoint scalar;
        if (rightArgument instanceof FixMatrixToken) {
            if (((FixMatrixToken) rightArgument).getRowCount() != 1
                    || ((FixMatrixToken) rightArgument).getColumnCount() != 1) {
                // Throw an exception.
                return super._moduloElement(rightArgument);
View Full Code Here

     *  supported by the derived class.
     *  @return A new Token containing the result.
     */
    protected MatrixToken _subtractElementReverse(Token rightArgument)
            throws IllegalActionException {
        FixPoint scalar;
        if (rightArgument instanceof FixMatrixToken) {
            if (((FixMatrixToken) rightArgument).getRowCount() != 1
                    || ((FixMatrixToken) rightArgument).getColumnCount() != 1) {
                // Throw an exception.
                return super._moduloElement(rightArgument);
            }
            scalar = ((FixMatrixToken) rightArgument).getElementAt(0, 0);
        } else {
            scalar = ((FixToken) rightArgument).fixValue();
        }
        FixPoint[][] result = fixMatrix();

        for (int i = 0; i < _rowCount; i++) {
            for (int j = 0; j < _columnCount; j++) {
                result[i][j] = scalar.subtract(result[i][j]);
            }
        }

        return new FixMatrixToken(result);
    }
View Full Code Here

     *  This method calls the {@link ptolemy.math.FixPoint#FixPoint(int)}
     *  constructor, so the precision and quantization are the what ever
     *  is defined for that constructor
     */
    public FixToken() {
        _value = new FixPoint(0);
    }
View Full Code Here

    public FixToken(double value, Precision precision)
            throws IllegalArgumentException {
        try {
            FixPointQuantization q = new FixPointQuantization(precision,
                    Overflow.SATURATE, Rounding.NEAREST);
            _value = new FixPoint(value, q);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
View Full Code Here

            throws IllegalArgumentException {
        try {
            Precision precision = new Precision(numberOfBits, integerBits);
            FixPointQuantization q = new FixPointQuantization(precision,
                    Overflow.SATURATE, Rounding.NEAREST);
            _value = new FixPoint(value, q);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
    }
View Full Code Here

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

     *  the type of the argument is an FixToken
     *  @param rightArgument The token to divide this token by.
     *  @return A new FixToken containing the result.
     */
    protected ScalarToken _divide(ScalarToken rightArgument) {
        FixPoint result = _value.divide(((FixToken) rightArgument).fixValue());
        return new FixToken(result);
    }
View Full Code Here

     @param rightArgument The token to divide this token by.
     *  @param quant The quantization specification.
     *  @return A new FixToken containing the result.
     */
    protected ScalarToken _divide(ScalarToken rightArgument, Quantization quant) {
        FixPoint result = _value.divide(((FixToken) rightArgument).fixValue(),
                quant);
        return new FixToken(result);
    }
View Full Code Here

TOP

Related Classes of ptolemy.math.FixPoint$Error

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.