本文整理汇总了Java中org.apache.commons.math3.linear.MatrixDimensionMismatchException类的典型用法代码示例。如果您正苦于以下问题:Java MatrixDimensionMismatchException类的具体用法?Java MatrixDimensionMismatchException怎么用?Java MatrixDimensionMismatchException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MatrixDimensionMismatchException类属于org.apache.commons.math3.linear包,在下文中一共展示了MatrixDimensionMismatchException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTransitionMeasurementMatrixMismatch
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
@Test(expected=MatrixDimensionMismatchException.class)
public void testTransitionMeasurementMatrixMismatch() {
// A and H matrix do not match in dimensions
// A = [ 1 ]
RealMatrix A = new Array2DRowRealMatrix(new double[] { 1d });
// no control input
RealMatrix B = null;
// H = [ 1 1 ]
RealMatrix H = new Array2DRowRealMatrix(new double[] { 1d, 1d });
// Q = [ 0 ]
RealMatrix Q = new Array2DRowRealMatrix(new double[] { 0 });
// R = [ 0 ]
RealMatrix R = new Array2DRowRealMatrix(new double[] { 0 });
ProcessModel pm
= new DefaultProcessModel(A, B, Q,
new ArrayRealVector(new double[] { 0 }), null);
MeasurementModel mm = new DefaultMeasurementModel(H, R);
new KalmanFilter(pm, mm);
Assert.fail("transition and measurement matrix should not be compatible");
}
示例2: testTransitionControlMatrixMismatch
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
@Test(expected=MatrixDimensionMismatchException.class)
public void testTransitionControlMatrixMismatch() {
// A and B matrix do not match in dimensions
// A = [ 1 ]
RealMatrix A = new Array2DRowRealMatrix(new double[] { 1d });
// B = [ 1 1 ]
RealMatrix B = new Array2DRowRealMatrix(new double[] { 1d, 1d });
// H = [ 1 ]
RealMatrix H = new Array2DRowRealMatrix(new double[] { 1d });
// Q = [ 0 ]
RealMatrix Q = new Array2DRowRealMatrix(new double[] { 0 });
// R = [ 0 ]
RealMatrix R = new Array2DRowRealMatrix(new double[] { 0 });
ProcessModel pm
= new DefaultProcessModel(A, B, Q,
new ArrayRealVector(new double[] { 0 }), null);
MeasurementModel mm = new DefaultMeasurementModel(H, R);
new KalmanFilter(pm, mm);
Assert.fail("transition and control matrix should not be compatible");
}
示例3: copySubMatrix
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public void copySubMatrix(
int arg0,
int arg1,
int arg2,
int arg3,
double[][] arg4
) throws OutOfRangeException,
NumberIsTooSmallException,
MatrixDimensionMismatchException {
matrix.copySubMatrix(
arg0,
arg1,
arg2,
arg3,
arg4
);
}
示例4: setProperties
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
@Override
protected void setProperties(Properties data) throws IllegalArgumentException {
// currently constant - write/read for future extension
Utils.getDouble(data, KEY_MEASUREMENT_NOISE, DEFAULT_MEASUREMENT_NOISE); // ignore value
RealMatrix mA = getMatrix(data, KEY_MATRIX_A, DEFAULT_A);
RealMatrix mB = getMatrix(data, KEY_MATRIX_B, DEFAULT_B);
RealMatrix mH = getMatrix(data, KEY_MATRIX_H, DEFAULT_H);
RealMatrix mQ = getMatrix(data, KEY_MATRIX_Q, DEFAULT_Q);
RealMatrix mR = getMatrix(data, KEY_MATRIX_R, DEFAULT_R);
// variable
RealMatrix mP = getMatrix(data, KEY_MATRIX_P, DEFAULT_P);
RealVector xVector = getVector(data, KEY_VECTOR_X, DEFAULT_X_VECTOR);
controlVector = getVector(data, KEY_VECTOR_CONTROL, controlVector);
lastUpdated = Utils.getLong(data, KEY_LAST_UPDATED, lastUpdated);
lastUpdate = Utils.getDouble(data, KEY_LAST_UPDATE, lastUpdate);
allowedGap = Utils.getInt(data, KEY_ALLOWED_GAP, allowedGap);
defaultMeasurement = Utils.getDouble(data, KEY_DEFAULT_MEASUREMENT, defaultMeasurement);
try {
ProcessModel pm = new DefaultProcessModel(mA, mB, mQ, xVector, mP); // xVector, mP
MeasurementModel mm = new DefaultMeasurementModel(mH, mR);
filter = new KalmanFilter(pm, mm);
} catch (NullArgumentException | DimensionMismatchException | MatrixDimensionMismatchException e) {
throw new IllegalArgumentException(e.getMessage());
}
}
示例5: setColumn
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public void setColumn(
int arg0,
double[] arg1
) throws OutOfRangeException,
MatrixDimensionMismatchException {
matrix.setColumn(
arg0,
arg1
);
}
示例6: setColumnVector
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public void setColumnVector(
int arg0,
RealVector arg1
) throws OutOfRangeException, MatrixDimensionMismatchException {
matrix.setColumnVector(
arg0,
arg1
);
}
示例7: setRow
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public void setRow(
int arg0,
double[] arg1
) throws OutOfRangeException,
MatrixDimensionMismatchException {
matrix.setRow(
arg0,
arg1);
}
示例8: setRowMatrix
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public void setRowMatrix(
int arg0,
RealMatrix arg1
) throws OutOfRangeException, MatrixDimensionMismatchException {
matrix.setRowMatrix(
arg0,
arg1
);
}
示例9: setRowVector
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public void setRowVector(
int arg0,
RealVector arg1
) throws OutOfRangeException, MatrixDimensionMismatchException {
matrix.setRowVector(
arg0,
arg1
);
}
示例10: StateSpaceModel
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public StateSpaceModel(DoubleMatrix state_transition_matrix,
DoubleMatrix observation_matrix,
DoubleMatrix transition_covariance_matrix,
DoubleMatrix observation_covariance_matrix,
DoubleMatrix initial_state_mean,
DoubleMatrix initial_state_covariance,
DoubleMatrix[] observations) {
dimension_of_states_ = observation_matrix.getColumns();
dimension_of_observations_ = observation_matrix.getRows();
observation_matrix_ref_ = observation_matrix;
if (!state_transition_matrix.isSquare() ||
state_transition_matrix.getRows() != dimension_of_states_) {
throw new MatrixDimensionMismatchException(state_transition_matrix.getRows(),
state_transition_matrix.getColumns(),
dimension_of_states_,
dimension_of_states_);
}
state_transition_matrix_ref_ = state_transition_matrix;
if (!transition_covariance_matrix.isSquare() ||
transition_covariance_matrix.getRows() != dimension_of_states_) {
throw new MatrixDimensionMismatchException(transition_covariance_matrix.getRows(),
transition_covariance_matrix.getColumns(),
dimension_of_states_,
dimension_of_states_);
}
transition_covariance_matrix_ref_ = transition_covariance_matrix;
if (!observation_covariance_matrix.isSquare() ||
observation_covariance_matrix.getRows() != dimension_of_observations_) {
throw new MatrixDimensionMismatchException(observation_covariance_matrix.getRows(),
observation_covariance_matrix.getColumns(),
dimension_of_observations_,
dimension_of_observations_);
}
observation_covariance_matrix_ref_ = observation_covariance_matrix;
if (initial_state_mean.getRows() != dimension_of_states_ ||
initial_state_mean.getColumns() != 1) {
throw new MatrixDimensionMismatchException(initial_state_mean.getRows(),
initial_state_mean.getColumns(),
dimension_of_states_,
1);
}
initial_state_mean_ref_ = initial_state_mean;
if (!initial_state_covariance.isSquare() ||
initial_state_covariance.getRows() != dimension_of_states_) {
throw new MatrixDimensionMismatchException(initial_state_covariance.getRows(),
initial_state_covariance.getColumns(),
dimension_of_states_,
dimension_of_states_);
}
initial_state_covariance_ref_ = initial_state_covariance;
number_of_observations_ = observations.length;
observations_ref_ = observations;
estimated_state_means_ = new DoubleMatrix[number_of_observations_];
estimated_state_covariances_ = new DoubleMatrix[number_of_observations_];
predicted_observation_means_ = new DoubleMatrix[number_of_observations_];
predicted_observation_covariances_ = new DoubleMatrix[number_of_observations_];
estimated_means_ = new DoubleMatrix[number_of_observations_];
estimated_covariances_ = new DoubleMatrix[number_of_observations_];
updateFilteredStates();
calculateLogLikelihood();
}
示例11: add
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public RealMatrix add(
RealMatrix arg0) throws MatrixDimensionMismatchException {
return matrix.add(arg0);
}
示例12: setColumnMatrix
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public void setColumnMatrix(
int arg0,
RealMatrix arg1
) throws OutOfRangeException,
MatrixDimensionMismatchException {
matrix.setColumnMatrix(
arg0,
arg1
);
}
示例13: subtract
import org.apache.commons.math3.linear.MatrixDimensionMismatchException; //导入依赖的package包/类
public RealMatrix subtract(RealMatrix arg0) throws MatrixDimensionMismatchException {
return matrix.subtract(arg0);
}