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.core;
025    
026    import org.ujmp.core.annotation.HasAnnotation;
027    import org.ujmp.core.calculation.CanPerformCalculations;
028    import org.ujmp.core.calculation.DivideMatrix;
029    import org.ujmp.core.calculation.DivideMatrixCalculation;
030    import org.ujmp.core.calculation.DivideScalar;
031    import org.ujmp.core.calculation.DivideScalarCalculation;
032    import org.ujmp.core.calculation.MinusMatrix;
033    import org.ujmp.core.calculation.MinusMatrixCalculation;
034    import org.ujmp.core.calculation.MinusScalar;
035    import org.ujmp.core.calculation.MinusScalarCalculation;
036    import org.ujmp.core.calculation.Mtimes;
037    import org.ujmp.core.calculation.MtimesCalculation;
038    import org.ujmp.core.calculation.PlusMatrix;
039    import org.ujmp.core.calculation.PlusMatrixCalculation;
040    import org.ujmp.core.calculation.PlusScalar;
041    import org.ujmp.core.calculation.PlusScalarCalculation;
042    import org.ujmp.core.calculation.TimesMatrix;
043    import org.ujmp.core.calculation.TimesMatrixCalculation;
044    import org.ujmp.core.calculation.TimesScalar;
045    import org.ujmp.core.calculation.TimesScalarCalculation;
046    import org.ujmp.core.calculation.Transpose;
047    import org.ujmp.core.calculation.TransposeCalculation;
048    import org.ujmp.core.calculation.Calculation.Ret;
049    import org.ujmp.core.doublematrix.calculation.general.decomposition.Chol;
050    import org.ujmp.core.doublematrix.calculation.general.decomposition.Eig;
051    import org.ujmp.core.doublematrix.calculation.general.decomposition.Inv;
052    import org.ujmp.core.doublematrix.calculation.general.decomposition.LU;
053    import org.ujmp.core.doublematrix.calculation.general.decomposition.QR;
054    import org.ujmp.core.doublematrix.calculation.general.decomposition.SVD;
055    import org.ujmp.core.doublematrix.calculation.general.decomposition.Solve;
056    import org.ujmp.core.interfaces.BasicMatrixProperties;
057    import org.ujmp.core.interfaces.Conversions;
058    import org.ujmp.core.interfaces.CoordinateFunctions;
059    import org.ujmp.core.interfaces.CoreObject;
060    import org.ujmp.core.interfaces.DistanceMeasures;
061    import org.ujmp.core.interfaces.GettersAndSetters;
062    import org.ujmp.core.io.ExportMatrixInterface;
063    import org.ujmp.core.matrix.factory.MatrixFactoryRoot;
064    
065    /**
066     * <code>Matrix</code> is the main class for storing any type of data. You have
067     * to choose the suitable implementation for your needs, e.g.
068     * <code>DefaultDenseDoubleMatrix2D</code> to store double values or
069     * DefaultGenericMatrix if you want to specify the object type.
070     * 
071     * 
072     * @author Holger Arndt
073     * @version $Revision$
074     * @date $Date$
075     * 
076     * @log $Log$
077     * 
078     */
079    public interface Matrix extends CoreObject, ExportMatrixInterface, CoordinateFunctions,
080                    GettersAndSetters, BasicMatrixProperties, CanPerformCalculations, DistanceMeasures,
081                    Comparable<Matrix>, HasAnnotation, Conversions {
082    
083            public enum StorageType {
084                    DENSE, SPARSE, LIST, SET, MAP, TREE, GRAPH
085            };
086    
087            /**
088             * A factory for creating matrices.
089             */
090            public static final MatrixFactoryRoot factory = new MatrixFactoryTemp();
091    
092            public static final Ret LINK = Ret.LINK;
093    
094            public static final Ret ORIG = Ret.ORIG;
095    
096            public static final Ret NEW = Ret.NEW;
097    
098            public static final int Y = 0;
099    
100            public static final int X = 1;
101    
102            public static final int Z = 2;
103    
104            public static final int ROW = 0;
105    
106            public static final int COLUMN = 1;
107    
108            public static final int ALL = 0x7fffffff;
109    
110            public static final int NONE = -1;
111    
112            public static TransposeCalculation<Matrix, Matrix> transpose = Transpose.MATRIX;
113    
114            public static PlusMatrixCalculation<Matrix, Matrix, Matrix> plusMatrix = PlusMatrix.MATRIX;
115    
116            public static MinusMatrixCalculation<Matrix, Matrix, Matrix> minusMatrix = MinusMatrix.MATRIX;
117    
118            public static TimesMatrixCalculation<Matrix, Matrix, Matrix> timesMatrix = TimesMatrix.MATRIX;
119    
120            public static DivideMatrixCalculation<Matrix, Matrix, Matrix> divideMatrix = DivideMatrix.MATRIX;
121    
122            public static PlusScalarCalculation<Matrix, Matrix> plusScalar = PlusScalar.MATRIX;
123    
124            public static MinusScalarCalculation<Matrix, Matrix> minusScalar = MinusScalar.MATRIX;
125    
126            public static TimesScalarCalculation<Matrix, Matrix> timesScalar = TimesScalar.MATRIX;
127    
128            public static DivideScalarCalculation<Matrix, Matrix> divideScalar = DivideScalar.MATRIX;
129    
130            public static MtimesCalculation<Matrix, Matrix, Matrix> mtimes = Mtimes.MATRIX;
131    
132            public static SVD<Matrix> svd = org.ujmp.core.doublematrix.calculation.general.decomposition.SVD.INSTANCE;
133    
134            public static LU<Matrix> lu = org.ujmp.core.doublematrix.calculation.general.decomposition.LU.INSTANCE;
135    
136            public static QR<Matrix> qr = org.ujmp.core.doublematrix.calculation.general.decomposition.QR.INSTANCE;
137    
138            public static Inv<Matrix> inv = Inv.INSTANCE;
139    
140            public static Solve<Matrix> solve = Solve.INSTANCE;
141    
142            public static Chol<Matrix> chol = Chol.INSTANCE;
143    
144            public static Eig<Matrix> eig = Eig.INSTANCE;
145    
146            public MatrixFactoryRoot getFactory();
147    
148            public Matrix clone();
149    
150    }