Makes a maximum matrix accumulator that accumulates the maximum of matrix elements.

@return a maximum vector accumulator
971988
public static MatrixAccumulator mkMaxAccumulator() {
        return new MatrixAccumulator() {
            private double result = Double.NEGATIVE_INFINITY;

            @Override
            public void update(int i, int j, double value) {
                result = Math.max(result, value);
            }

            @Override
            public double accumulate() {
                double value = result;
                result = Double.NEGATIVE_INFINITY;
                return value;
            }
        };
    }
468867
public double getMaxDimension() {
		if (maxDimension!=0) {
			return maxDimension;
		}
		Point3d vert0 = new Point3d(0,0,0);
		Point3d vert1 = new Point3d(1,0,0);
		transfToOrthonormal(vert1);
		Point3d vert2 = new Point3d(0,1,0);
		transfToOrthonormal(vert2);
		Point3d vert3 = new Point3d(0,0,1);
		transfToOrthonormal(vert3);
		Point3d vert4 = new Point3d(1,1,0);
		transfToOrthonormal(vert4);
		Point3d vert5 = new Point3d(1,0,1);
		transfToOrthonormal(vert5);
		Point3d vert6 = new Point3d(0,1,1);
		transfToOrthonormal(vert6);
		Point3d vert7 = new Point3d(1,1,1);
		transfToOrthonormal(vert7);

		ArrayList<Double> vertDists = new ArrayList<Double>();
		vertDists.add(vert0.distance(vert7));
		vertDists.add(vert3.distance(vert4));
		vertDists.add(vert1.distance(vert6));
		vertDists.add(vert2.distance(vert5));
		maxDimension = Collections.max(vertDists);
		return maxDimension;
	}
644168
public DoubleVector centerOfMass() {
        // Handle lazy initialization
        if (centroid == null) {
            if (indices.size() == 1)
                centroid = sumVector;
            else {
                // Update the centroid by normalizing by the number of elements.
                // We expect that the centroid vector might be compared with
                // other vectors multiple times. If we used a ScaledVector here,
                // we would be re-doing this multiplication each time, which is
                // wasted. The centerOfMass is already lazily instantiated, so
                // we know that if we do the computation here we'll be using the
                // results at least once.  Therefore do the normalization here
                // once to save cost.
                int length = sumVector.length();
                double d = 1d / indices.size();
                if (sumVector instanceof SparseVector) {
                    centroid = new SparseHashDoubleVector(length);
                    SparseVector sv = (SparseVector)sumVector;
                    for (int nz : sv.getNonZeroIndices())
                        centroid.set(nz, sumVector.get(nz) * d);
                }
                else {
                    centroid = new DenseVector(length);
                    for (int i = 0; i < length; ++i) 
                        centroid.set(i, sumVector.get(i) * d);                    
                }
            }
        }
        return centroid;
    }
464247
public int getMax() {
        List<Integer> value = new ArrayList<Integer>();
        for (AnalysisType at : analysisType) {
            value.add(at.getValue());
        }
        return Collections.max(value);
    }
920548
public double[] foldNonZeroInRows(VectorAccumulator accumulator) {
        double[] result = new double[rows];

        for (int i = 0; i < rows; i++) {
            result[i] = foldNonZeroInRow(i, accumulator);
        }

        return result;
    }
819784
public static double elementMaxAbs( ZMatrixRMaj a ) {
        final int size = a.getDataLength();

        double max = 0;
        for( int i = 0; i < size; i += 2 ) {
            double real = a.data[i];
            double imag = a.data[i+1];

            double val = real*real + imag*imag;

            if( val > max ) {
                max = val;
            }
        }

        return Math.sqrt(max);
    }
941150
public static MatrixAccumulator mkManhattanNormAccumulator() {
        return new MatrixAccumulator() {
            private double result = 0.0;

            @Override
            public void update(int i, int j, double value) {
                result += Math.abs(value);
            }

            @Override
            public double accumulate() {
                double value = result;
                result = 0.0;
                return value;
            }
        };
    }
741469
function() {
            	var maxes = [];

            	for(var i = 1; i <= this.rows(); i++) {
            	    var max = null;
            	    var maxIndex = -1;

            	    for(var j = 1; j <= this.cols(); j++) {
            		if(max === null || this.e(i, j) > max) {
            		    max = this.e(i, j);
            		    maxIndex = j;
            		}
            	    }

            	    maxes.push(maxIndex);
            	}

            	return $V(maxes);
                }
1266825
public static double elementMaxAbs( DMatrix6 a ) {
        double max = Math.abs(a.a1);
        double tmp = Math.abs(a.a2); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a2); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a3); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a4); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a5); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a6); if( tmp > max ) max = tmp;

        return max;
    }
168586
public static double elementMax( DMatrix3 a ) {
        double max = a.a1;
        if( a.a2 > max ) max = a.a2;
        if( a.a3 > max ) max = a.a3;

        return max;
    }
920389
public static int getMaxIndex(DoubleMatrix1D v){
	  	int maxIndex = -1;
	  	double maxValue = -Double.MAX_VALUE;
	  	for(int i=0; i<v.size(); i++){
	  		if(v.getQuick(i)>maxValue){
	  			maxIndex = i;
	  			maxValue = v.getQuick(i); 
	  		}
	  	}
	  	return maxIndex; 
	  }
584335
public static double elementMax( DMatrix4x4 a ) {
        double max = a.a11;
        if( a.a12 > max ) max = a.a12;
        if( a.a13 > max ) max = a.a13;
        if( a.a14 > max ) max = a.a14;
        if( a.a21 > max ) max = a.a21;
        if( a.a22 > max ) max = a.a22;
        if( a.a23 > max ) max = a.a23;
        if( a.a24 > max ) max = a.a24;
        if( a.a31 > max ) max = a.a31;
        if( a.a32 > max ) max = a.a32;
        if( a.a33 > max ) max = a.a33;
        if( a.a34 > max ) max = a.a34;
        if( a.a41 > max ) max = a.a41;
        if( a.a42 > max ) max = a.a42;
        if( a.a43 > max ) max = a.a43;
        if( a.a44 > max ) max = a.a44;

        return max;
    }
616373
public Matrix getR () {
		Matrix X = new Matrix(n,n);
		double[][] R = X.getArray();
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (i < j) {
					R[i][j] = QR[i][j];
				} else if (i == j) {
					R[i][j] = Rdiag[i];
				} else {
					R[i][j] = 0.0;
				}
			}
		}
		return X;
	}
1288791
public static double max(DoubleArrayND array)
    {
        return array.stream().parallel().reduce(
            Double.NEGATIVE_INFINITY, Math::max);
    }
657404
public static double elementMax( DMatrix3x3 a ) {
        double max = a.a11;
        if( a.a12 > max ) max = a.a12;
        if( a.a13 > max ) max = a.a13;
        if( a.a21 > max ) max = a.a21;
        if( a.a22 > max ) max = a.a22;
        if( a.a23 > max ) max = a.a23;
        if( a.a31 > max ) max = a.a31;
        if( a.a32 > max ) max = a.a32;
        if( a.a33 > max ) max = a.a33;

        return max;
    }
890259
public static VectorAccumulator mkMinAccumulator() {
        return new VectorAccumulator() {
            private double result = Double.POSITIVE_INFINITY;

            @Override
            public void update(int i, double value) {
                result = Math.min(result, value);
            }

            @Override
            public double accumulate() {
                double value = result;
                result = Double.POSITIVE_INFINITY;
                return value;
            }
        };
    }
265395
public RowMajorMatrixIterator rowMajorIterator() {
        return new RowMajorMatrixIterator(rows, columns) {
            private long limit = (long) rows * columns;
            private int i = - 1;

            @Override
            public int rowIndex() {
                return i / columns;
            }

            @Override
            public int columnIndex() {
                return i - rowIndex() * columns;
            }

            @Override
            public double get() {
                return Matrix.this.get(rowIndex(), columnIndex());
            }

            @Override
            public void set(double value) {
                Matrix.this.set(rowIndex(), columnIndex(), value);
            }

            @Override
            public boolean hasNext() {
                return i + 1 < limit;
            }

            @Override
            public Double next() {
                if(!hasNext()) {
                    throw new NoSuchElementException();
                }

                i++;
                return get();
            }
        };
    }