001    /*
002     * Copyright (C) 2008-2010 by Holger Arndt
003     *
004     * This file is part of the Universal Java Matrix Package (UJMP).
005     * See the NOTICE file distributed with this work for additional
006     * information regarding copyright ownership and licensing.
007     *
008     * UJMP is free software; you can redistribute it and/or modify
009     * it under the terms of the GNU Lesser General Public License as
010     * published by the Free Software Foundation; either version 2
011     * of the License, or (at your option) any later version.
012     *
013     * UJMP is distributed in the hope that it will be useful,
014     * but WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016     * GNU Lesser General Public License for more details.
017     *
018     * You should have received a copy of the GNU Lesser General Public
019     * License along with UJMP; if not, write to the
020     * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
021     * Boston, MA  02110-1301  USA
022     */
023    
024    package org.ujmp.commonsmath;
025    
026    import org.apache.commons.math.linear.BlockRealMatrix;
027    import org.ujmp.core.Coordinates;
028    import org.ujmp.core.Matrix;
029    import org.ujmp.core.doublematrix.factory.DenseDoubleMatrix2DFactory;
030    import org.ujmp.core.exceptions.MatrixException;
031    
032    public class CommonsMathBlockDenseDoubleMatrix2D extends
033                    AbstractCommonsMathDenseDoubleMatrix2D {
034            private static final long serialVersionUID = 4040628102089767983L;
035    
036            public static final DenseDoubleMatrix2DFactory factory = new CommonsMathBlockDenseDoubleMatrix2DFactory();
037    
038            public CommonsMathBlockDenseDoubleMatrix2D(long... size) {
039                    super(Coordinates.isZero(size) ? null : new BlockRealMatrix(
040                                    (int) size[ROW], (int) size[COLUMN]));
041            }
042    
043            public CommonsMathBlockDenseDoubleMatrix2D(org.ujmp.core.Matrix source)
044                            throws MatrixException {
045                    this(source.getSize());
046                    for (long[] c : source.availableCoordinates()) {
047                            setDouble(source.getAsDouble(c), c);
048                    }
049            }
050    
051            public CommonsMathBlockDenseDoubleMatrix2D(BlockRealMatrix matrix) {
052                    super(matrix);
053            }
054    
055            public Matrix chol() {
056                    return super.chol();
057            }
058    
059            public Matrix inv() {
060                    return super.inv();
061            }
062    
063            public Matrix transpose() {
064                    return super.transpose();
065            }
066    
067            public Matrix mtimes(Matrix m) {
068                    return super.mtimes(m);
069            }
070    
071            public Matrix plus(Matrix m) {
072                    return super.plus(m);
073            }
074    
075            public Matrix minus(Matrix m) {
076                    return super.minus(m);
077            }
078    
079            public Matrix[] eig() {
080                    return super.eig();
081            }
082    
083            public Matrix[] lu() {
084                    return super.lu();
085            }
086    
087            public Matrix[] svd() {
088                    return super.svd();
089            }
090    
091            public Matrix[] qr() {
092                    return super.qr();
093            }
094    
095            public Matrix plus(double value) {
096                    return super.plus(value);
097            }
098    
099            public Matrix minus(double value) {
100                    return super.minus(value);
101            }
102    
103            public Matrix times(double value) {
104                    return super.times(value);
105            }
106    
107            public Matrix divide(double value) {
108                    return super.divide(value);
109            }
110    
111            public Matrix solve(Matrix b) {
112                    return super.solve(b);
113            }
114    
115            public DenseDoubleMatrix2DFactory getFactory() {
116                    return factory;
117            }
118    
119    }