本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.AT_LEAST_ONE_COLUMN属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.AT_LEAST_ONE_COLUMN属性的具体用法?Java LocalizedFormats.AT_LEAST_ONE_COLUMN怎么用?Java LocalizedFormats.AT_LEAST_ONE_COLUMN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.AT_LEAST_ONE_COLUMN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Array2DRowFieldMatrix
/**
* Create a new {@code FieldMatrix<T>} using the input array as the underlying
* data array.
* <p>If an array is built specially in order to be embedded in a
* {@code FieldMatrix<T>} and not used directly, the {@code copyArray} may be
* set to {@code false}. This will prevent the copying and improve
* performance as no new array will be built and no data will be copied.</p>
*
* @param field Field to which the elements belong.
* @param d Data for the new matrix.
* @param copyArray Whether to copy or reference the input array.
* @throws DimensionMismatchException if {@code d} is not rectangular.
* @throws NoDataException if there are not at least one row and one column.
* @throws NullArgumentException if {@code d} is {@code null}.
* @see #Array2DRowFieldMatrix(FieldElement[][])
*/
public Array2DRowFieldMatrix(final Field<T> field, final T[][] d, final boolean copyArray)
throws DimensionMismatchException, NoDataException, NullArgumentException {
super(field);
if (copyArray) {
copyIn(d);
} else {
MathUtils.checkNotNull(d);
final int nRows = d.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = d[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; r++) {
if (d[r].length != nCols) {
throw new DimensionMismatchException(nCols, d[r].length);
}
}
data = d;
}
}
示例2: Array2DRowRealMatrix
/**
* Create a new RealMatrix using the input array as the underlying
* data array.
* If an array is built specially in order to be embedded in a
* RealMatrix and not used directly, the {@code copyArray} may be
* set to {@code false}. This will prevent the copying and improve
* performance as no new array will be built and no data will be copied.
*
* @param d Data for new matrix.
* @param copyArray if {@code true}, the input array will be copied,
* otherwise it will be referenced.
* @throws DimensionMismatchException if {@code d} is not rectangular.
* @throws NoDataException if {@code d} row or column dimension is zero.
* @throws NullArgumentException if {@code d} is {@code null}.
* @see #Array2DRowRealMatrix(double[][])
*/
public Array2DRowRealMatrix(final double[][] d, final boolean copyArray)
throws DimensionMismatchException, NoDataException,
NullArgumentException {
if (copyArray) {
copyIn(d);
} else {
if (d == null) {
throw new NullArgumentException();
}
final int nRows = d.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = d[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; r++) {
if (d[r].length != nCols) {
throw new DimensionMismatchException(d[r].length, nCols);
}
}
data = d;
}
}
示例3: createRowFieldMatrix
/**
* Create a row {@link FieldMatrix} using the data from the input
* array.
*
* @param <T> the type of the field elements
* @param rowData the input row data
* @return a 1 x rowData.length FieldMatrix
* @throws NoDataException if {@code rowData} is empty.
* @throws NullArgumentException if {@code rowData} is {@code null}.
*/
public static <T extends FieldElement<T>> FieldMatrix<T>
createRowFieldMatrix(final T[] rowData)
throws NoDataException, NullArgumentException {
if (rowData == null) {
throw new NullArgumentException();
}
final int nCols = rowData.length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
final FieldMatrix<T> m = createFieldMatrix(rowData[0].getField(), 1, nCols);
for (int i = 0; i < nCols; ++i) {
m.setEntry(0, i, rowData[i]);
}
return m;
}
示例4: Array2DRowRealMatrix
/**
* Create a new RealMatrix using the input array as the underlying
* data array.
* If an array is built specially in order to be embedded in a
* RealMatrix and not used directly, the {@code copyArray} may be
* set to {@code false}. This will prevent the copying and improve
* performance as no new array will be built and no data will be copied.
*
* @param d Data for new matrix.
* @param copyArray if {@code true}, the input array will be copied,
* otherwise it will be referenced.
* @throws DimensionMismatchException if {@code d} is not rectangular
* (not all rows have the same length) or empty.
* @throws NullArgumentException if {@code d} is {@code null}.
* @throws NoDataException if there are not at least one row and one column.
* @see #Array2DRowRealMatrix(double[][])
*/
public Array2DRowRealMatrix(final double[][] d, final boolean copyArray) {
if (copyArray) {
copyIn(d);
} else {
if (d == null) {
throw new NullArgumentException();
}
final int nRows = d.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = d[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; r++) {
if (d[r].length != nCols) {
throw new DimensionMismatchException(d[r].length, nCols);
}
}
data = d;
}
}
示例5: createRowFieldMatrix
/**
* Create a row {@link FieldMatrix} using the data from the input
* array.
*
* @param <T> the type of the field elements
* @param rowData the input row data
* @return a 1 x rowData.length FieldMatrix
* @throws NoDataException if {@code rowData} is empty.
* @throws NullArgumentException if {@code rowData} is {@code null}.
*/
public static <T extends FieldElement<T>> FieldMatrix<T>
createRowFieldMatrix(final T[] rowData) {
if (rowData == null) {
throw new NullArgumentException();
}
final int nCols = rowData.length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
final FieldMatrix<T> m = createFieldMatrix(rowData[0].getField(), 1, nCols);
for (int i = 0; i < nCols; ++i) {
m.setEntry(0, i, rowData[i]);
}
return m;
}
示例6: setSubMatrix
/** {@inheritDoc} */
@Override
public void setSubMatrix(final T[][] subMatrix, final int row,
final int column)
throws OutOfRangeException, NullArgumentException, NoDataException,
DimensionMismatchException {
if (data == null) {
if (row > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
}
if (column > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
}
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
data = MathArrays.buildArray(getField(), subMatrix.length, nCols);
for (int i = 0; i < data.length; ++i) {
if (subMatrix[i].length != nCols) {
throw new DimensionMismatchException(nCols, subMatrix[i].length);
}
System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
}
} else {
super.setSubMatrix(subMatrix, row, column);
}
}
示例7: setSubMatrix
/** {@inheritDoc} */
@Override
public void setSubMatrix(final double[][] subMatrix, final int row,
final int column)
throws NoDataException, OutOfRangeException,
DimensionMismatchException, NullArgumentException {
if (data == null) {
if (row > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
}
if (column > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
}
MathUtils.checkNotNull(subMatrix);
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
data = new double[subMatrix.length][nCols];
for (int i = 0; i < data.length; ++i) {
if (subMatrix[i].length != nCols) {
throw new DimensionMismatchException(subMatrix[i].length, nCols);
}
System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
}
} else {
super.setSubMatrix(subMatrix, row, column);
}
}
示例8: extractField
/**
* Get the elements type from an array.
*
* @param <T> Type of the field elements.
* @param d Data array.
* @return the field to which the array elements belong.
* @throws NullArgumentException if the array is {@code null}.
* @throws NoDataException if the array is empty.
*/
protected static <T extends FieldElement<T>> Field<T> extractField(final T[][] d)
throws NoDataException, NullArgumentException {
if (d == null) {
throw new NullArgumentException();
}
if (d.length == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
if (d[0].length == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
return d[0][0].getField();
}
示例9: setSubMatrix
/** {@inheritDoc} */
public void setSubMatrix(final T[][] subMatrix, final int row,
final int column)
throws DimensionMismatchException, OutOfRangeException,
NoDataException, NullArgumentException {
if (subMatrix == null) {
throw new NullArgumentException();
}
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; ++r) {
if (subMatrix[r].length != nCols) {
throw new DimensionMismatchException(nCols, subMatrix[r].length);
}
}
checkRowIndex(row);
checkColumnIndex(column);
checkRowIndex(nRows + row - 1);
checkColumnIndex(nCols + column - 1);
for (int i = 0; i < nRows; ++i) {
for (int j = 0; j < nCols; ++j) {
setEntry(row + i, column + j, subMatrix[i][j]);
}
}
}
示例10: setSubMatrix
/** {@inheritDoc} */
public void setSubMatrix(final double[][] subMatrix, final int row, final int column)
throws NoDataException, OutOfRangeException,
DimensionMismatchException, NullArgumentException {
MathUtils.checkNotNull(subMatrix);
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; ++r) {
if (subMatrix[r].length != nCols) {
throw new DimensionMismatchException(nCols, subMatrix[r].length);
}
}
MatrixUtils.checkRowIndex(this, row);
MatrixUtils.checkColumnIndex(this, column);
MatrixUtils.checkRowIndex(this, nRows + row - 1);
MatrixUtils.checkColumnIndex(this, nCols + column - 1);
for (int i = 0; i < nRows; ++i) {
for (int j = 0; j < nCols; ++j) {
setEntry(row + i, column + j, subMatrix[i][j]);
}
}
}
示例11: setSubMatrix
/** {@inheritDoc} */
@Override
public void setSubMatrix(final T[][] subMatrix, final int row, final int column) {
if (data == null) {
if (row > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
}
if (column > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
}
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
data = buildArray(getField(), subMatrix.length, nCols);
for (int i = 0; i < data.length; ++i) {
if (subMatrix[i].length != nCols) {
throw new DimensionMismatchException(nCols, subMatrix[i].length);
}
System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
}
} else {
super.setSubMatrix(subMatrix, row, column);
}
}
示例12: setSubMatrix
/** {@inheritDoc} */
@Override
public void setSubMatrix(final double[][] subMatrix,
final int row, final int column) {
if (data == null) {
if (row > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
}
if (column > 0) {
throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
}
MathUtils.checkNotNull(subMatrix);
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
data = new double[subMatrix.length][nCols];
for (int i = 0; i < data.length; ++i) {
if (subMatrix[i].length != nCols) {
throw new DimensionMismatchException(subMatrix[i].length, nCols);
}
System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
}
} else {
super.setSubMatrix(subMatrix, row, column);
}
}
示例13: extractField
/**
* Get the elements type from an array.
*
* @param <T> Type of the field elements.
* @param d Data array.
* @return the field to which the array elements belong.
* @throws NullArgumentException if the array is {@code null}.
* @throws NoDataException if the array is empty.
*/
protected static <T extends FieldElement<T>> Field<T> extractField(final T[][] d) {
if (d == null) {
throw new NullArgumentException();
}
if (d.length == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
if (d[0].length == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
return d[0][0].getField();
}
示例14: setSubMatrix
/** {@inheritDoc} */
public void setSubMatrix(final T[][] subMatrix, final int row, final int column) {
if (subMatrix == null) {
throw new NullArgumentException();
}
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; ++r) {
if (subMatrix[r].length != nCols) {
throw new DimensionMismatchException(nCols, subMatrix[r].length);
}
}
checkRowIndex(row);
checkColumnIndex(column);
checkRowIndex(nRows + row - 1);
checkColumnIndex(nCols + column - 1);
for (int i = 0; i < nRows; ++i) {
for (int j = 0; j < nCols; ++j) {
setEntry(row + i, column + j, subMatrix[i][j]);
}
}
}
示例15: setSubMatrix
/** {@inheritDoc} */
public void setSubMatrix(final double[][] subMatrix, final int row, final int column)
throws NoDataException, DimensionMismatchException, NullArgumentException {
MathUtils.checkNotNull(subMatrix);
final int nRows = subMatrix.length;
if (nRows == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
}
final int nCols = subMatrix[0].length;
if (nCols == 0) {
throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
}
for (int r = 1; r < nRows; ++r) {
if (subMatrix[r].length != nCols) {
throw new DimensionMismatchException(nCols, subMatrix[r].length);
}
}
MatrixUtils.checkRowIndex(this, row);
MatrixUtils.checkColumnIndex(this, column);
MatrixUtils.checkRowIndex(this, nRows + row - 1);
MatrixUtils.checkColumnIndex(this, nCols + column - 1);
for (int i = 0; i < nRows; ++i) {
for (int j = 0; j < nCols; ++j) {
setEntry(row + i, column + j, subMatrix[i][j]);
}
}
}