com.aliasi.matrix

Class Matrices

• ```public class Matrices
extends Object```
The `Matrices` class contains static utility methods for various matrix properties and operations.
Since:
LingPipe2.0
Version:
3.5
Author:
Bob Carpenter
• Method Summary

All Methods
Modifier and Type Method and Description
`static boolean` `hasZeroDiagonal(Matrix m)`
Returns `true` if the specified matrix has only zero values on its diagonal.
`static boolean` `isNonNegative(Matrix m)`
Returns `true` if the matrix contains only positive numbers or zeros.
`static boolean` `isSymmetric(Matrix m)`
Returns `true` if the specified matrix is symmetric.
`static double[]` `toArray(Vector v)`
Returns the content of the specified vector as an array.
`static Vector` `unmodifiableVector(Vector v)`
Returns an unmodifiable view of the specified vector.
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Method Detail

• unmodifiableVector

`public static Vector unmodifiableVector(Vector v)`
Returns an unmodifiable view of the specified vector. This provides a "read-only" version of the specified vector. The returned vector is backed by the specified vector, so changes to the specified vector will be refelcted in the returned vector. An unmodifiable vector throws an `UnsupportedOperationException` if `Vector.setValue(int,double)` is called.
Parameters:
`v` - Vector to return an
• hasZeroDiagonal

`public static boolean hasZeroDiagonal(Matrix m)`
Returns `true` if the specified matrix has only zero values on its diagonal. If the matrix is not square or has non-zero values on the diagonal, the return result is `false`.
Parameters:
`m` - Matrix to test.
Returns:
`true` if the matrix is square and has only zero values on its diagonal.
• isSymmetric

`public static boolean isSymmetric(Matrix m)`
Returns `true` if the specified matrix is symmetric. A matrix `m` is symmetric if it's equal to its transpose, `m = mT`. Stated directly, a matrix `m` is symmetric if it has the same number of rows as columns:
``` m.numRows() == m.numColumns() ```
and meets the symmetry condition:
`m.value(i,j) == m.value(j,i)` for `i,j < m.numRows()`.
Parameters:
`m` - Matrix to test.
Returns:
`true` if the matrix is symmetric.
• isNonNegative

`public static boolean isNonNegative(Matrix m)`
Returns `true` if the matrix contains only positive numbers or zeros. If it contains a finite negative number, `Double.NaN`, or `Double.NEGATIVE_INFINITY`, the result will be `false`.
Parameters:
`m` - Matrix to test.
Returns:
`true` if the matrix contains only positive entries or zeros.
• toArray

`public static double[] toArray(Vector v)`
Returns the content of the specified vector as an array.
Parameters:
`v` - The vector.
Returns:
The content of the vector as an array.