本文整理汇总了Java中org.apache.commons.math3.linear.NonSquareMatrixException类的典型用法代码示例。如果您正苦于以下问题:Java NonSquareMatrixException类的具体用法?Java NonSquareMatrixException怎么用?Java NonSquareMatrixException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NonSquareMatrixException类属于org.apache.commons.math3.linear包,在下文中一共展示了NonSquareMatrixException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Weight
import org.apache.commons.math3.linear.NonSquareMatrixException; //导入依赖的package包/类
/**
* @param weight Weight matrix.
* @throws NonSquareMatrixException if the argument is not
* a square matrix.
*/
public Weight(RealMatrix weight) {
if (weight.getColumnDimension() != weight.getRowDimension()) {
throw new NonSquareMatrixException(weight.getColumnDimension(),
weight.getRowDimension());
}
weightMatrix = weight.copy();
}
示例2: getTrace
import org.apache.commons.math3.linear.NonSquareMatrixException; //导入依赖的package包/类
public double getTrace() throws NonSquareMatrixException {
return matrix.getTrace();
}
示例3: power
import org.apache.commons.math3.linear.NonSquareMatrixException; //导入依赖的package包/类
public RealMatrix power(int arg0) throws NotPositiveException, NonSquareMatrixException {
return matrix.power(arg0);
}
示例4: validateCovarianceData
import org.apache.commons.math3.linear.NonSquareMatrixException; //导入依赖的package包/类
/**
* Validates that the x data and covariance matrix have the same
* number of rows and that the covariance matrix is square.
*
* @param x the [n,k] array representing the x sample
* @param covariance the [n,n] array representing the covariance matrix
* @throws DimensionMismatchException if the number of rows in x is not equal
* to the number of rows in covariance
* @throws NonSquareMatrixException if the covariance matrix is not square
*/
protected void validateCovarianceData(double[][] x, double[][] covariance) {
if (x.length != covariance.length) {
throw new DimensionMismatchException(x.length, covariance.length);
}
if (covariance.length > 0 && covariance.length != covariance[0].length) {
throw new NonSquareMatrixException(covariance.length, covariance[0].length);
}
}