super.preinitialize();
DoubleMatrixToken a = (DoubleMatrixToken)A.getToken();
int n = a.getRowCount();
DoubleMatrixToken b = (DoubleMatrixToken)B.getToken();
if (b.getRowCount() != n) {
throw new IllegalActionException(this, "The number of rows of the B matrix should equal to " + "the number of rows of the A matrix.");
}
if (n == 1) {
$ASSIGN$_singleState(true);
state.setTypeEquals(BaseType.DOUBLE);
} else {
$ASSIGN$_singleState(false);
state.setTypeEquals(BaseType.DOUBLE_MATRIX);
}
int m = b.getColumnCount();
if (m == 1) {
input.setTypeEquals(BaseType.DOUBLE);
} else {
input.setTypeEquals(BaseType.DOUBLE_MATRIX);
}
DoubleMatrixToken c = (DoubleMatrixToken)C.getToken();
if (c.getColumnCount() != n) {
throw new IllegalActionException(this, "The number of columns of the C matrix should equal to " + "the number of rows of the A matrix.");
}
int r = c.getRowCount();
if (r == 1) {
$ASSIGN$_singleOutput(true);
output.setTypeEquals(BaseType.DOUBLE);
} else {
$ASSIGN$_singleOutput(false);
output.setTypeEquals(BaseType.DOUBLE_MATRIX);
}
DoubleMatrixToken d = (DoubleMatrixToken)D.getToken();
if (c.getRowCount() != d.getRowCount()) {
throw new IllegalActionException(this, "The number of rows of the D matrix should equal to " + "the number of rows of the C matrix.");
}
DoubleMatrixToken x0 = (DoubleMatrixToken)initialStates.getToken();
if (x0.getRowCount() != n) {
throw new IllegalActionException(this, "The number of initial states should equal to " + "the number of columns of the A matrix.");
}
$ASSIGN$_initialStateChanged(true);
}