Package | Description |
---|---|
ptolemy.math |
Math classes.
|
Modifier and Type | Field and Description |
---|---|
static Fraction |
Fraction.ZERO
The value of zero as a Fraction.
|
Modifier and Type | Method and Description |
---|---|
Fraction |
Fraction.add(Fraction b)
Add this fraction to the given fraction.
|
static Fraction[][] |
FractionMatrixMath.add(Fraction[][] matrix,
Fraction z)
Return a new matrix that is constructed from the argument by
adding the second argument to every element.
|
static Fraction[][] |
FractionMatrixMath.add(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
adding the second matrix to the first one.
|
static Fraction[] |
FractionArrayMath.add(Fraction[] array,
Fraction z)
Return a new array that is the formed by adding z to each element
of the input array.
|
static Fraction[] |
FractionArrayMath.add(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element sum of the two
input arrays.
|
static Fraction[] |
FractionArrayMath.allocCopy(Fraction[] array)
Return a new array that is a copy of the array argument.
|
static Fraction[][] |
FractionMatrixMath.allocCopy(Fraction[][] matrix)
Return a new matrix that is a copy of the matrix argument.
|
static Fraction[] |
FractionArrayMath.append(Fraction[] array1,
Fraction[] array2)
Return a new array that is the result of appending array2 to the end
of array1.
|
static Fraction[] |
FractionArrayMath.append(Fraction[] array1,
int idx1,
int length1,
Fraction[] array2,
int idx2,
int length2)
Return a new array that is the result of appending length2
elements of array2, starting from the array2[idx2] to length1
elements of array1, starting from array1[idx1].
|
static Fraction[][] |
FractionMatrixMath.crop(Fraction[][] matrix,
int rowStart,
int colStart,
int rowSpan,
int colSpan)
Return a new matrix that is a sub-matrix of the input
matrix argument.
|
static Fraction[][] |
FractionMatrixMath.diag(Fraction[] array)
Return a new matrix that is constructed by placing the
elements of the input array on the diagonal of the square
matrix, starting from the top left corner down to the bottom
right corner.
|
Fraction |
Fraction.divide(Fraction b)
Divide this fraction by the given fraction.
|
static Fraction[][] |
FractionMatrixMath.divide(Fraction[][] matrix,
Fraction z)
Return a new matrix that is constructed from the argument by
dividing the second argument to every element.
|
static Fraction[] |
FractionArrayMath.divide(Fraction[] num,
Fraction[] den)
Return a new array that is the element-by-element division of
the first array by the second array.
|
static Fraction[][] |
FractionMatrixMath.divideElements(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed by element by element
division of the two matrix arguments.
|
static Fraction |
FractionArrayMath.dotProduct(Fraction[] array1,
Fraction[] array2)
Return the dot product of the two arrays.
|
static Fraction[] |
FractionMatrixMath.fromMatrixToArray(Fraction[][] matrix)
Return a new array that is filled with the contents of the matrix.
|
static Fraction[] |
FractionMatrixMath.fromMatrixToArray(Fraction[][] matrix,
int maxRow,
int maxCol)
Return a new array that is filled with the contents of the matrix.
|
static Fraction[][] |
FractionMatrixMath.identity(int dim)
Return an new identity matrix with the specified dimension.
|
Fraction |
Fraction.inverse()
Find the multiplicative inverse of this fraction.
|
Fraction |
Fraction.multiply(Fraction b)
Multiply this fraction by the given fraction.
|
static Fraction[][] |
FractionMatrixMath.multiply(Fraction[][] matrix,
Fraction scaleFactor)
Return a new matrix that is constructed by multiplying the matrix
by a scaleFactor.
|
static Fraction[] |
FractionMatrixMath.multiply(Fraction[][] matrix,
Fraction[] array)
Return a new array that is constructed from the argument by
post-multiplying the matrix by an array (treated as a column vector).
|
static Fraction[][] |
FractionMatrixMath.multiply(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
multiplying the first matrix by the second one.
|
static Fraction[] |
FractionArrayMath.multiply(Fraction[] array,
Fraction factor)
Return a new array that is constructed from the argument by
multiplying each element in the array by the second argument, which is
a Fraction.
|
static Fraction[] |
FractionArrayMath.multiply(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element multiplication of
the two input arrays.
|
static Fraction[] |
FractionMatrixMath.multiply(Fraction[] array,
Fraction[][] matrix)
Return a new array that is constructed from the argument by
pre-multiplying the matrix by an array (treated as a row vector).
|
static Fraction[][] |
FractionMatrixMath.multiplyElements(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed by element by element
multiplication of the two matrix arguments.
|
Fraction |
Fraction.negate()
Find the additive inverse of this fraction.
|
static Fraction[] |
FractionArrayMath.negative(Fraction[] array)
Return a new array that is the formed by the additive inverse of each
element of the input array (-array[i]).
|
static Fraction[][] |
FractionMatrixMath.negative(Fraction[][] matrix)
Return a new matrix that is the additive inverse of the
argument matrix.
|
Fraction |
Fraction.subtract(Fraction b)
Subtract the given fraction from this fraction.
|
static Fraction[][] |
FractionMatrixMath.subtract(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
subtracting the second matrix from the first one.
|
static Fraction[] |
FractionArrayMath.subtract(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element difference of the
two input arrays, i.e. the first array minus the second array
(array1[i] - array2[i]).
|
static Fraction |
FractionArrayMath.sum(Fraction[] array)
Return the sum of the elements in the array.
|
static Fraction |
FractionMatrixMath.sum(Fraction[][] matrix)
Return the sum of the elements of a matrix.
|
static Fraction[][] |
FractionMatrixMath.toMatrixFromArray(Fraction[] array,
int rows,
int cols)
Return a new matrix of Fractions that is initialized from a 1-D array.
|
static Fraction |
FractionMatrixMath.trace(Fraction[][] matrix)
Return the trace of a square matrix, which is the sum of the
diagonal entries A11 + A22 + ... + Ann
Throw an IllegalArgumentException if the matrix is not square.
|
static Fraction[][] |
FractionMatrixMath.transpose(Fraction[][] matrix)
Return a new matrix that is constructed by transposing the input
matrix.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
FractionMatrixMath._checkSameDimension(java.lang.String caller,
Fraction[][] matrix1,
Fraction[][] matrix2)
Check that the two matrix arguments are of the same dimension.
|
protected static void |
FractionMatrixMath._checkSameDimension(java.lang.String caller,
Fraction[][] matrix1,
Fraction[][] matrix2)
Check that the two matrix arguments are of the same dimension.
|
protected static int |
FractionMatrixMath._checkSquare(java.lang.String caller,
Fraction[][] matrix)
Check that the argument matrix is a square matrix.
|
protected static int |
FractionMatrixMath._columns(Fraction[][] matrix)
Return the number of columns of a matrix.
|
protected static int |
FractionArrayMath._commonLength(Fraction[] array1,
Fraction[] array2,
java.lang.String methodName)
Throw an exception if the two arrays are not of the same length,
or if either array is null.
|
protected static int |
FractionArrayMath._commonLength(Fraction[] array1,
Fraction[] array2,
java.lang.String methodName)
Throw an exception if the two arrays are not of the same length,
or if either array is null.
|
protected static java.lang.String |
FractionMatrixMath._dimensionString(Fraction[][] matrix)
Return a string that describes the number of rows and columns.
|
protected static int |
FractionMatrixMath._rows(Fraction[][] matrix)
Return the number of rows of a matrix.
|
Fraction |
Fraction.add(Fraction b)
Add this fraction to the given fraction.
|
static Fraction[][] |
FractionMatrixMath.add(Fraction[][] matrix,
Fraction z)
Return a new matrix that is constructed from the argument by
adding the second argument to every element.
|
static Fraction[][] |
FractionMatrixMath.add(Fraction[][] matrix,
Fraction z)
Return a new matrix that is constructed from the argument by
adding the second argument to every element.
|
static Fraction[][] |
FractionMatrixMath.add(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
adding the second matrix to the first one.
|
static Fraction[][] |
FractionMatrixMath.add(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
adding the second matrix to the first one.
|
static Fraction[] |
FractionArrayMath.add(Fraction[] array,
Fraction z)
Return a new array that is the formed by adding z to each element
of the input array.
|
static Fraction[] |
FractionArrayMath.add(Fraction[] array,
Fraction z)
Return a new array that is the formed by adding z to each element
of the input array.
|
static Fraction[] |
FractionArrayMath.add(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element sum of the two
input arrays.
|
static Fraction[] |
FractionArrayMath.add(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element sum of the two
input arrays.
|
static Fraction[] |
FractionArrayMath.allocCopy(Fraction[] array)
Return a new array that is a copy of the array argument.
|
static Fraction[][] |
FractionMatrixMath.allocCopy(Fraction[][] matrix)
Return a new matrix that is a copy of the matrix argument.
|
static Fraction[] |
FractionArrayMath.append(Fraction[] array1,
Fraction[] array2)
Return a new array that is the result of appending array2 to the end
of array1.
|
static Fraction[] |
FractionArrayMath.append(Fraction[] array1,
Fraction[] array2)
Return a new array that is the result of appending array2 to the end
of array1.
|
static Fraction[] |
FractionArrayMath.append(Fraction[] array1,
int idx1,
int length1,
Fraction[] array2,
int idx2,
int length2)
Return a new array that is the result of appending length2
elements of array2, starting from the array2[idx2] to length1
elements of array1, starting from array1[idx1].
|
static Fraction[] |
FractionArrayMath.append(Fraction[] array1,
int idx1,
int length1,
Fraction[] array2,
int idx2,
int length2)
Return a new array that is the result of appending length2
elements of array2, starting from the array2[idx2] to length1
elements of array1, starting from array1[idx1].
|
static Fraction[][] |
FractionMatrixMath.crop(Fraction[][] matrix,
int rowStart,
int colStart,
int rowSpan,
int colSpan)
Return a new matrix that is a sub-matrix of the input
matrix argument.
|
static Fraction[][] |
FractionMatrixMath.diag(Fraction[] array)
Return a new matrix that is constructed by placing the
elements of the input array on the diagonal of the square
matrix, starting from the top left corner down to the bottom
right corner.
|
Fraction |
Fraction.divide(Fraction b)
Divide this fraction by the given fraction.
|
static Fraction[][] |
FractionMatrixMath.divide(Fraction[][] matrix,
Fraction z)
Return a new matrix that is constructed from the argument by
dividing the second argument to every element.
|
static Fraction[][] |
FractionMatrixMath.divide(Fraction[][] matrix,
Fraction z)
Return a new matrix that is constructed from the argument by
dividing the second argument to every element.
|
static Fraction[] |
FractionArrayMath.divide(Fraction[] num,
Fraction[] den)
Return a new array that is the element-by-element division of
the first array by the second array.
|
static Fraction[] |
FractionArrayMath.divide(Fraction[] num,
Fraction[] den)
Return a new array that is the element-by-element division of
the first array by the second array.
|
static Fraction[][] |
FractionMatrixMath.divideElements(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed by element by element
division of the two matrix arguments.
|
static Fraction[][] |
FractionMatrixMath.divideElements(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed by element by element
division of the two matrix arguments.
|
static Fraction |
FractionArrayMath.dotProduct(Fraction[] array1,
Fraction[] array2)
Return the dot product of the two arrays.
|
static Fraction |
FractionArrayMath.dotProduct(Fraction[] array1,
Fraction[] array2)
Return the dot product of the two arrays.
|
static boolean |
FractionArrayMath.equals(Fraction[] array1,
Fraction[] array2)
Returns true if the two input arrays have all elements
equal.
|
static boolean |
FractionArrayMath.equals(Fraction[] array1,
Fraction[] array2)
Returns true if the two input arrays have all elements
equal.
|
static Fraction[] |
FractionMatrixMath.fromMatrixToArray(Fraction[][] matrix)
Return a new array that is filled with the contents of the matrix.
|
static Fraction[] |
FractionMatrixMath.fromMatrixToArray(Fraction[][] matrix,
int maxRow,
int maxCol)
Return a new array that is filled with the contents of the matrix.
|
boolean |
Fraction.greaterThan(Fraction testInput)
Test if this Fraction is greater than the input.
|
Fraction |
Fraction.multiply(Fraction b)
Multiply this fraction by the given fraction.
|
static Fraction[][] |
FractionMatrixMath.multiply(Fraction[][] matrix,
Fraction scaleFactor)
Return a new matrix that is constructed by multiplying the matrix
by a scaleFactor.
|
static Fraction[][] |
FractionMatrixMath.multiply(Fraction[][] matrix,
Fraction scaleFactor)
Return a new matrix that is constructed by multiplying the matrix
by a scaleFactor.
|
static Fraction[] |
FractionMatrixMath.multiply(Fraction[][] matrix,
Fraction[] array)
Return a new array that is constructed from the argument by
post-multiplying the matrix by an array (treated as a column vector).
|
static Fraction[] |
FractionMatrixMath.multiply(Fraction[][] matrix,
Fraction[] array)
Return a new array that is constructed from the argument by
post-multiplying the matrix by an array (treated as a column vector).
|
static Fraction[][] |
FractionMatrixMath.multiply(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
multiplying the first matrix by the second one.
|
static Fraction[][] |
FractionMatrixMath.multiply(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
multiplying the first matrix by the second one.
|
static Fraction[] |
FractionArrayMath.multiply(Fraction[] array,
Fraction factor)
Return a new array that is constructed from the argument by
multiplying each element in the array by the second argument, which is
a Fraction.
|
static Fraction[] |
FractionArrayMath.multiply(Fraction[] array,
Fraction factor)
Return a new array that is constructed from the argument by
multiplying each element in the array by the second argument, which is
a Fraction.
|
static Fraction[] |
FractionArrayMath.multiply(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element multiplication of
the two input arrays.
|
static Fraction[] |
FractionArrayMath.multiply(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element multiplication of
the two input arrays.
|
static Fraction[] |
FractionMatrixMath.multiply(Fraction[] array,
Fraction[][] matrix)
Return a new array that is constructed from the argument by
pre-multiplying the matrix by an array (treated as a row vector).
|
static Fraction[] |
FractionMatrixMath.multiply(Fraction[] array,
Fraction[][] matrix)
Return a new array that is constructed from the argument by
pre-multiplying the matrix by an array (treated as a row vector).
|
static Fraction[][] |
FractionMatrixMath.multiplyElements(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed by element by element
multiplication of the two matrix arguments.
|
static Fraction[][] |
FractionMatrixMath.multiplyElements(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed by element by element
multiplication of the two matrix arguments.
|
static Fraction[] |
FractionArrayMath.negative(Fraction[] array)
Return a new array that is the formed by the additive inverse of each
element of the input array (-array[i]).
|
static Fraction[][] |
FractionMatrixMath.negative(Fraction[][] matrix)
Return a new matrix that is the additive inverse of the
argument matrix.
|
Fraction |
Fraction.subtract(Fraction b)
Subtract the given fraction from this fraction.
|
static Fraction[][] |
FractionMatrixMath.subtract(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
subtracting the second matrix from the first one.
|
static Fraction[][] |
FractionMatrixMath.subtract(Fraction[][] matrix1,
Fraction[][] matrix2)
Return a new matrix that is constructed from the argument by
subtracting the second matrix from the first one.
|
static Fraction[] |
FractionArrayMath.subtract(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element difference of the
two input arrays, i.e. the first array minus the second array
(array1[i] - array2[i]).
|
static Fraction[] |
FractionArrayMath.subtract(Fraction[] array1,
Fraction[] array2)
Return a new array that is the element-by-element difference of the
two input arrays, i.e. the first array minus the second array
(array1[i] - array2[i]).
|
static Fraction |
FractionArrayMath.sum(Fraction[] array)
Return the sum of the elements in the array.
|
static Fraction |
FractionMatrixMath.sum(Fraction[][] matrix)
Return the sum of the elements of a matrix.
|
static double[] |
FractionArrayMath.toDoubleArray(Fraction[] array)
Return a new array that is formed by converting the Fractions in
the argument array to doubles.
|
static double[][] |
FractionMatrixMath.toDoubleMatrix(Fraction[][] matrix)
Return a new matrix that is formed by converting the Fractions in
the argument matrix to doubles.
|
static Fraction[][] |
FractionMatrixMath.toMatrixFromArray(Fraction[] array,
int rows,
int cols)
Return a new matrix of Fractions that is initialized from a 1-D array.
|
static java.lang.String |
FractionArrayMath.toString(Fraction[] array)
Return a new String representing the array, formatted as
in Java array initializers.
|
static java.lang.String |
FractionMatrixMath.toString(Fraction[][] matrix)
Return a new String representing the matrix, formatted as
in Java array initializers.
|
static java.lang.String |
FractionMatrixMath.toString(Fraction[][] matrix,
java.lang.String elementDelimiter,
java.lang.String matrixBegin,
java.lang.String matrixEnd,
java.lang.String vectorBegin,
java.lang.String vectorDelimiter,
java.lang.String vectorEnd)
Return a new String representing the matrix, formatted as
specified by the ArrayStringFormat argument.
|
static java.lang.String |
FractionArrayMath.toString(Fraction[] array,
java.lang.String elementDelimiter,
java.lang.String vectorBegin,
java.lang.String vectorEnd)
Return a new String representing the array, formatted as
specified by the ArrayStringFormat argument.
|
static Fraction |
FractionMatrixMath.trace(Fraction[][] matrix)
Return the trace of a square matrix, which is the sum of the
diagonal entries A11 + A22 + ... + Ann
Throw an IllegalArgumentException if the matrix is not square.
|
static Fraction[][] |
FractionMatrixMath.transpose(Fraction[][] matrix)
Return a new matrix that is constructed by transposing the input
matrix.
|
Constructor and Description |
---|
Fraction(Fraction f)
Create a new fraction with the same value as the given fraction.
|