Example usage for org.apache.commons.math3.linear AbstractRealMatrix AbstractRealMatrix

List of usage examples for org.apache.commons.math3.linear AbstractRealMatrix AbstractRealMatrix

Introduction

In this page you can find the example usage for org.apache.commons.math3.linear AbstractRealMatrix AbstractRealMatrix.

Prototype

protected AbstractRealMatrix(final int rowDimension, final int columnDimension)
        throws NotStrictlyPositiveException 

Source Link

Document

Create a new RealMatrix with the supplied row and column dimensions.

Usage

From source file:edu.cmu.tetrad.util.MatrixUtils.java

public static RealMatrix transposeWithoutCopy(final RealMatrix apacheData) {
    return new AbstractRealMatrix(apacheData.getColumnDimension(), apacheData.getRowDimension()) {
        @Override/*from  w w  w  .j a v a2  s .c om*/
        public int getRowDimension() {
            return apacheData.getColumnDimension();
        }

        @Override
        public int getColumnDimension() {
            return apacheData.getRowDimension();
        }

        @Override
        public RealMatrix createMatrix(int rowDimension, int columnDimension)
                throws NotStrictlyPositiveException {
            return apacheData.createMatrix(rowDimension, columnDimension);
        }

        @Override
        public RealMatrix copy() {
            throw new IllegalArgumentException("Can't copy");
        }

        @Override
        public double getEntry(int i, int j) throws OutOfRangeException {
            //                throw new UnsupportedOperationException();
            return apacheData.getEntry(j, i);
        }

        @Override
        public void setEntry(int i, int j, double v) throws OutOfRangeException {
            throw new UnsupportedOperationException();
        }
    };
}