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.doublematrix.calculation.general.statistical;
025    
026    import org.ujmp.core.Matrix;
027    import org.ujmp.core.calculation.Calculation.Ret;
028    import org.ujmp.core.exceptions.MatrixException;
029    
030    public interface StatisticalDoubleCalculations {
031    
032            public Matrix diff(Ret returnType, int dimension, boolean ignoreNaN) throws MatrixException;
033    
034            public Matrix prod(Ret returnType, int dimension, boolean ignoreNaN) throws MatrixException;
035    
036            public Matrix cumsum(boolean ignoreNaN) throws MatrixException;
037    
038            public Matrix cumprod(boolean ignoreNaN) throws MatrixException;
039    
040            /**
041             * Calculates the mimimum of the values in the matrix either rowwise,
042             * columnwise, or global.
043             * 
044             * @param returnType
045             *            Select whether a new or a linked Matrix is returned, or if the
046             *            operation is performed on the original Matrix
047             * @param dimension
048             *            the axis along which should be calculated, e.g. ROW=0,
049             *            COLUMN=1 or ALL
050             * @return A new matrix containing the minimum values
051             */
052            public Matrix min(Ret returnType, int dimension) throws MatrixException;
053    
054            /**
055             * Calculates the maximum of the values in the matrix either rowwise,
056             * columnwise, or global.
057             * 
058             * @param returnType
059             *            Select whether a new or a linked Matrix is returned, or if the
060             *            operation is performed on the original Matrix
061             * @param dimension
062             *            the axis along which should be calculated, e.g. ROW=0,
063             *            COLUMN=1 or ALL
064             * @return A new matrix containing the maximum values
065             */
066            public Matrix max(Ret returnType, int dimension) throws MatrixException;
067    
068            /**
069             * Calculates the sum of all entries in the Matrix either per row, per
070             * column, or global.
071             * 
072             * @param returnType
073             *            Select whether a new or a linked Matrix is returned, or if the
074             *            operation is performed on the original Matrix
075             * @param dimension
076             *            The axis along which to calculate
077             * @param ignoreNaN
078             *            should missing values be ignored
079             * @return Matrix with the sum of the values along the desired axis
080             */
081            public Matrix sum(Ret returnType, int dimension, boolean ignoreNaN) throws MatrixException;
082    
083            /**
084             * Calculates the mean of all entries in the Matrix either per row, per
085             * column, or global.
086             * 
087             * @param returnType
088             *            Select whether a new or a linked Matrix is returned, or if the
089             *            operation is performed on the original Matrix
090             * @param dimension
091             *            The axis along which to calculate
092             * @param ignoreNaN
093             *            should missing values be ignored
094             * @return Matrix with the sum of the values along the desired axis
095             */
096            public Matrix mean(Ret returnType, int dimension, boolean ignoreNaN) throws MatrixException;
097    
098            /**
099             * Calculates the variance of all entries in the Matrix either per row, per
100             * column, or global.
101             * 
102             * @param returnType
103             *            Select whether a new or a linked Matrix is returned, or if the
104             *            operation is performed on the original Matrix
105             * @param dimension
106             *            The axis along which to calculate
107             * @param ignoreNaN
108             *            should missing values be ignored
109             * @return Matrix with the sum of the values along the desired axis
110             */
111            public Matrix var(Ret returnType, int dimension, boolean ignoreNaN) throws MatrixException;
112    
113            /**
114             * Calculates the standard deviation of all entries in the Matrix either per
115             * row, per column, or global.
116             * 
117             * @param returnType
118             *            Select whether a new or a linked Matrix is returned, or if the
119             *            operation is performed on the original Matrix
120             * @param dimension
121             *            The axis along which to calculate
122             * @param ignoreNaN
123             *            should missing values be ignored
124             * @return Matrix with the sum of the values along the desired axis
125             */
126            public Matrix std(Ret returnType, int dimension, boolean ignoreNaN) throws MatrixException;
127    
128            /**
129             * Calculates the covariance Matrix. Each row is an observation and each
130             * column is a variable.
131             * 
132             * @param returnType
133             *            Select whether a new or a linked Matrix is returned, or if the
134             *            operation is performed on the original Matrix
135             * @param ignoreNaN
136             *            should missing values be ignored
137             * @return Covariance Matrix
138             */
139            public Matrix cov(Ret returnType, boolean ignoreNaN) throws MatrixException;
140    
141            /**
142             * Calculates the Pearson correlation. Each row is an observation and each
143             * column is a variable.
144             * 
145             * @param returnType
146             *            Select whether a new or a linked Matrix is returned, or if the
147             *            operation is performed on the original Matrix
148             * @param ignoreNaN
149             *            should missing values be ignored
150             * @return Covariance Matrix
151             */
152            public Matrix corrcoef(Ret returnType, boolean ignoreNaN) throws MatrixException;
153    
154            /**
155             * Calculates the mutual information. Each row is an observation and each
156             * column is a variable.
157             * 
158             * @param returnType
159             *            Select whether a new or a linked Matrix is returned, or if the
160             *            operation is performed on the original Matrix
161             * @return Matrix with mutual information
162             */
163            public Matrix mutualInf(Ret returnType) throws MatrixException;
164    
165            /**
166             * Calculates a paired T-Test on the matrix. Each row is an observation and
167             * each column is a variable.
168             * 
169             * @param returnType
170             *            Select whether a new or a linked Matrix is returned, or if the
171             *            operation is performed on the original Matrix
172             * @return Matrix with p-values of the T-Test
173             */
174            public Matrix pairedTTest(Ret returnType) throws MatrixException;
175    
176            /**
177             * Finds the index of the maximum value in the matrix
178             * 
179             * @param returnType
180             *            Select whether a new or a linked Matrix is returned, or if the
181             *            operation is performed on the original Matrix
182             * @param dimension
183             *            The axis along which to calculate
184             * @return Matrix containing the coordinates of the Maximum
185             */
186            public Matrix indexOfMax(Ret returnType, int dimension) throws MatrixException;
187    
188            /**
189             * Finds the index of the minimum value in the matrix
190             * 
191             * @param returnType
192             *            Select whether a new or a linked Matrix is returned, or if the
193             *            operation is performed on the original Matrix
194             * @param dimension
195             *            The axis along which to calculate
196             * @return Matrix containing the coordinates of the Minimum
197             */
198            public Matrix indexOfMin(Ret returnType, int dimension) throws MatrixException;
199    
200    }