/** * Returns an unmodifiable view of the given matrix. The returned matrix is immutable * only if the given {@code matrix} is not modified anymore after this method call. * * @param matrix the matrix for which to get an unmodifiable view, or {@code null}. * @return a unmodifiable view of the given matrix, or {@code null} if the given matrix was null. * * @since 0.6 */ public static MatrixSIS unmodifiable(final Matrix matrix) { if (matrix == null || matrix instanceof UnmodifiableMatrix) { return (MatrixSIS) matrix; } else { return new UnmodifiableMatrix(matrix); } }
/** * Unconditionally throws {@link UnsupportedOperationException} since this view is unmodifiable. */ @Override public void transpose() { throw canNotModify(); }
/** * Returns elements together with their error terms if available, or just the elements otherwise. */ @Override public double[] getExtendedElements() { if (matrix instanceof ExtendedPrecisionMatrix) { return ((ExtendedPrecisionMatrix) matrix).getExtendedElements(); } else { return getElements(); } }
/** * Returns a copy of this matrix that users can modify. */ @Override @SuppressWarnings("CloneDoesntCallSuperClone") public MatrixSIS clone() { return castOrCopy(matrix.clone()); } }
/** * Returns elements together with their error terms if available, or just the elements otherwise. */ @Override public double[] getExtendedElements() { if (matrix instanceof ExtendedPrecisionMatrix) { return ((ExtendedPrecisionMatrix) matrix).getExtendedElements(); } else { return getElements(); } }
/** * Returns a copy of this matrix that users can modify. */ @Override @SuppressWarnings("CloneDoesntCallSuperClone") public MatrixSIS clone() { return castOrCopy(matrix.clone()); } }
/** * Unconditionally throws {@link UnsupportedOperationException} since this view is unmodifiable. */ @Override public void setElements(double[] elements) { throw canNotModify(); }
/** * Returns an unmodifiable view of the given matrix. The returned matrix is immutable * only if the given {@code matrix} is not modified anymore after this method call. * * @param matrix the matrix for which to get an unmodifiable view, or {@code null}. * @return a unmodifiable view of the given matrix, or {@code null} if the given matrix was null. * * @since 0.6 */ public static MatrixSIS unmodifiable(final Matrix matrix) { if (matrix == null || matrix instanceof UnmodifiableMatrix) { return (MatrixSIS) matrix; } else { return new UnmodifiableMatrix(matrix); } }
/** * Unconditionally throws {@link UnsupportedOperationException} since this view is unmodifiable. */ @Override public void setElements(double[] elements) { throw canNotModify(); }
/** * Unconditionally throws {@link UnsupportedOperationException} since this view is unmodifiable. */ @Override public void transpose() { throw canNotModify(); }
/** * Unconditionally throws {@link UnsupportedOperationException} since this view is unmodifiable. */ @Override public void setElement(int row, int column, double value) { throw canNotModify(); }
/** * Unconditionally throws {@link UnsupportedOperationException} since this view is unmodifiable. */ @Override public void setElement(int row, int column, double value) { throw canNotModify(); }