PTOLEMY II - CiteSeerX
PTOLEMY II - CiteSeerX
PTOLEMY II - CiteSeerX
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Expressions<br />
Thus, for example, you can fill a row vector with a sine wave using an expression like<br />
sin([0.0:PI/100:1.0])<br />
Or you can construct an array as follows,<br />
sin({0.0, 0.1, 0.2, 0.3})<br />
Functions that operate on type double will also generally operate on int or unsignedByte, because these<br />
can be losslessly converted to double, but not generally on long or complex.<br />
Tables of available functions are shown in the appendix. For example, Table 4 on page 118 shows<br />
trigonometric functions. Note that these operate on double or complex, and hence on int and unsigned-<br />
Byte, which can be losslessly converted to double. The result will always be double. For example,<br />
>> cos(0)<br />
1.0<br />
These functions will also operate on matrices and arrays, in addition to the scalar types shown in the<br />
table, as illustrated above. The result will be a matrix or array of the same size as the argument, but<br />
always containing elements of type double<br />
Table 5 on page 119 shows other arithmetic functions beyond the trigonometric functions. As with<br />
the trigonometric functions, those that indicate that they operate on double will also work on int and<br />
unsignedByte, and unless they indicate otherwise, they will return whatever they return when the argument<br />
is double. Those functions in the table that take scalar arguments will also operate on matrices<br />
and arrays. For example, since the table indicates that the max() function can take int, int as arguments,<br />
TABLE 2: The classes whose static methods are available as functions in the expression language.<br />
java.lang.Math ptolemy.math.IntegerMatrixMath<br />
java.lang.Double ptolemy.math.DoubleMatrixMath<br />
java.lang.Integer ptolemy.math.ComplexMatrixMath<br />
java.lang.Long ptolemy.math.LongMatrixMath<br />
java.lang.String ptolemy.math.IntegerArrayMath<br />
ptolemy.data.MatrixToken ptolemy.math.DoubleArrayStat<br />
ptolemy.data.RecordToken ptolemy.math.ComplexArrayMath<br />
ptolemy.data.expr.UtilityFunctions ptolemy.math.LongArrayMath<br />
ptolemy.data.expr.FixPointFunctions ptolemy.math.SignalProcessing<br />
ptolemy.math.Complex<br />
ptolemy.math.ExtendedMath<br />
ptolemy.math.FixPoint<br />
Heterogeneous Concurrent Modeling and Design 111