Computes the p=&#8734; norm.  If A is a matrix then the induced norm is computed.

@param A Matrix or vector.
@return The norm.
518307
public static double normPInf( DMatrixRMaj A ) {
        if( MatrixFeatures_DDRM.isVector(A)) {
            return CommonOps_DDRM.elementMaxAbs(A);
        } else {
            return inducedPInf(A);
        }
    }
331753
public static double elementMin( DMatrix3x3 a ) {
        double min = a.a11;
        if( a.a12 < min ) min = a.a12;
        if( a.a13 < min ) min = a.a13;
        if( a.a21 < min ) min = a.a21;
        if( a.a22 < min ) min = a.a22;
        if( a.a23 < min ) min = a.a23;
        if( a.a31 < min ) min = a.a31;
        if( a.a32 < min ) min = a.a32;
        if( a.a33 < min ) min = a.a33;

        return min;
    }
919235
public static double cs_norm(DZcs A)
	{
		int p, j, n, Ap[] ;
		DZcsa Ax = new DZcsa() ;
		double norm = 0, s ;
		if (!CS_CSC (A) || A.x == null) return (-1) ;	/* check inputs */
		n = A.n ; Ap = A.p ; Ax.x = A.x ;
		for (j = 0 ; j < n ; j++)
		{
			for (s = 0, p = Ap [j] ; p < Ap [j+1] ; p++) s += cs_cabs(Ax.get(p)) ;
			norm = Math.max(norm, s) ;
		}
		return (norm) ;
	}
465032
public static double elementMaxAbs( DMatrix2x2 a ) {
        double max = Math.abs(a.a11);
        double tmp = Math.abs(a.a12); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a21); if( tmp > max ) max = tmp;
        tmp = Math.abs(a.a22); if( tmp > max ) max = tmp;

        return max;
    }
1298126
public static Matrix average(Matrix m, Dimension dim) {
        Matrix averageMatrix = null;

        if (dim == Dimension.ALL) {
            // Compute the average of all values in the matrix.
            double average = 0;
            for (int i = 0; i < m.rows(); ++i) {
                for (int j = 0; j < m.columns(); ++j)
                    average += m.get(i, j);
            }

            averageMatrix = new ArrayMatrix(1, 1);
            average = average / (double) (m.rows() * m.columns());
            averageMatrix.set(1, 1, average);
        } else if (dim == Dimension.ROW) {
            // Compute the average of each row in the matrix.
            averageMatrix = new ArrayMatrix(m.rows(), 1);
            for (int i = 0; i < m.rows(); ++i) {
                double average = 0;
                for (int j = 0; j < m.columns(); ++j)
                    average += m.get(i, j);

                average = average / (double) m.columns();
                averageMatrix.set(i, 0, average);
            }
        } else if (dim == Dimension.COLUMN) {
            // Compute the average of each column in the matrix.
            averageMatrix = new ArrayMatrix(1, m.columns());
            for (int i = 0; i < m.rows(); ++i) {
                for (int j = 0; j < m.columns(); ++j) {
                    double newValue = m.get(i, j) + averageMatrix.get(0, j);
                    averageMatrix.set(0, j, newValue);
                }
            }

            for (int i = 0; i < m.columns(); ++i) {
                double average = averageMatrix.get(0, i);
                average = average / (double) m.rows();
                averageMatrix.set(0, i, average);
            }
        }
        return averageMatrix;
    }
602380
public static float cs_norm(Scs A) {
        int p, j, n, Ap[];
        float Ax[], norm = 0, s;
        if (!Scs_util.CS_CSC(A) || A.x == null)
            return (-1); /* check inputs */
        n = A.n;
        Ap = A.p;
        Ax = A.x;
        for (j = 0; j < n; j++) {
            for (s = 0, p = Ap[j]; p < Ap[j + 1]; p++)
                s += Math.abs(Ax[p]);
            norm = Math.max(norm, s);
        }
        return (norm);
    }
138735
public static double norm_1(double[] a) {
    double sum = 0;
    for (double anA : a) {
      sum += (anA < 0 ? -anA : anA);
    }
    return sum;
  }
980677
public static double norm(double[] a) {
    double squaredSum = 0;
    for (double anA : a) {
      squaredSum += anA * anA;
    }
    return Math.sqrt(squaredSum);
  }
1125842
public double norm1()
    {
        double f = 0;
        for (int j = 0; j < n; j++)
        {
            double s = 0;
            for (int i = 0; i < m; i++)
            {
                s += Math.abs(A[i][j]);
            }
            f = Math.max(f, s);
        }
        return f;
    }
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;
    }
262079
public static double elementMax( DMatrix5x5 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.a15 > max ) max = a.a15;
        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.a25 > max ) max = a.a25;
        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.a35 > max ) max = a.a35;
        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;
        if( a.a45 > max ) max = a.a45;
        if( a.a51 > max ) max = a.a51;
        if( a.a52 > max ) max = a.a52;
        if( a.a53 > max ) max = a.a53;
        if( a.a54 > max ) max = a.a54;
        if( a.a55 > max ) max = a.a55;

        return max;
    }
386575
public static double elementMin( DMatrix5x5 a ) {
        double min = a.a11;
        if( a.a12 < min ) min = a.a12;
        if( a.a13 < min ) min = a.a13;
        if( a.a14 < min ) min = a.a14;
        if( a.a15 < min ) min = a.a15;
        if( a.a21 < min ) min = a.a21;
        if( a.a22 < min ) min = a.a22;
        if( a.a23 < min ) min = a.a23;
        if( a.a24 < min ) min = a.a24;
        if( a.a25 < min ) min = a.a25;
        if( a.a31 < min ) min = a.a31;
        if( a.a32 < min ) min = a.a32;
        if( a.a33 < min ) min = a.a33;
        if( a.a34 < min ) min = a.a34;
        if( a.a35 < min ) min = a.a35;
        if( a.a41 < min ) min = a.a41;
        if( a.a42 < min ) min = a.a42;
        if( a.a43 < min ) min = a.a43;
        if( a.a44 < min ) min = a.a44;
        if( a.a45 < min ) min = a.a45;
        if( a.a51 < min ) min = a.a51;
        if( a.a52 < min ) min = a.a52;
        if( a.a53 < min ) min = a.a53;
        if( a.a54 < min ) min = a.a54;
        if( a.a55 < min ) min = a.a55;

        return min;
    }
480730
protected double norm(double x, int i) {
    if (Double.isNaN(m_Ranges[i][R_MIN]) || (m_Ranges[i][R_MAX] == m_Ranges[i][R_MIN]))
      return 0;
    else
      return (x - m_Ranges[i][R_MIN]) / (m_Ranges[i][R_WIDTH]);
  }
1063472
public static double elementMin( DMatrix6x6 a ) {
        double min = a.a11;
        if( a.a12 < min ) min = a.a12;
        if( a.a13 < min ) min = a.a13;
        if( a.a14 < min ) min = a.a14;
        if( a.a15 < min ) min = a.a15;
        if( a.a16 < min ) min = a.a16;
        if( a.a21 < min ) min = a.a21;
        if( a.a22 < min ) min = a.a22;
        if( a.a23 < min ) min = a.a23;
        if( a.a24 < min ) min = a.a24;
        if( a.a25 < min ) min = a.a25;
        if( a.a26 < min ) min = a.a26;
        if( a.a31 < min ) min = a.a31;
        if( a.a32 < min ) min = a.a32;
        if( a.a33 < min ) min = a.a33;
        if( a.a34 < min ) min = a.a34;
        if( a.a35 < min ) min = a.a35;
        if( a.a36 < min ) min = a.a36;
        if( a.a41 < min ) min = a.a41;
        if( a.a42 < min ) min = a.a42;
        if( a.a43 < min ) min = a.a43;
        if( a.a44 < min ) min = a.a44;
        if( a.a45 < min ) min = a.a45;
        if( a.a46 < min ) min = a.a46;
        if( a.a51 < min ) min = a.a51;
        if( a.a52 < min ) min = a.a52;
        if( a.a53 < min ) min = a.a53;
        if( a.a54 < min ) min = a.a54;
        if( a.a55 < min ) min = a.a55;
        if( a.a56 < min ) min = a.a56;
        if( a.a61 < min ) min = a.a61;
        if( a.a62 < min ) min = a.a62;
        if( a.a63 < min ) min = a.a63;
        if( a.a64 < min ) min = a.a64;
        if( a.a65 < min ) min = a.a65;
        if( a.a66 < min ) min = a.a66;

        return min;
    }
1334511
public double compute( DMatrix1Row mat ) {
        if( width != mat.numCols || width != mat.numRows ) {
            throw new RuntimeException("Unexpected matrix dimension");
        }

        // make sure everything is in the proper state before it starts
        initStructures();

//        System.arraycopy(mat.data,0,minorMatrix[0],0,mat.data.length);

        int level = 0;
        while( true ) {
            int levelWidth = width-level;
            int levelIndex = levelIndexes[level];

            if( levelIndex == levelWidth ) {
                if( level == 0 ) {
                    return levelResults[0];
                }
                int prevLevelIndex = levelIndexes[level-1]++;

                double val = mat.get((level-1)*width+levelRemoved[level-1]);
                if( prevLevelIndex % 2 == 0 ) {
                    levelResults[level-1] += val * levelResults[level];
                } else {
                    levelResults[level-1] -= val * levelResults[level];
                }

                putIntoOpen(level-1);

                levelResults[level] = 0;
                levelIndexes[level] = 0;
                level--;
            } else {
                int excluded = openRemove( levelIndex );

                levelRemoved[level] = excluded;

                if( levelWidth == minWidth ) {
                    createMinor(mat);
                    double subresult = mat.get(level*width+levelRemoved[level]);

                    subresult *= UnrolledDeterminantFromMinor_DDRM.det(tempMat);

                    if( levelIndex % 2 == 0 ) {
                        levelResults[level] += subresult;
                    } else {
                        levelResults[level] -= subresult;
                    }

                    // put it back into the list
                    putIntoOpen(level);
                    levelIndexes[level]++;
                } else {
                    level++;
                }
            }
        }
    }
1342811
public double norm_vector(double[] z) {
    double sum = 0;

    for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
      sum += z[i] * z[i];
    }

    return Math.sqrt(sum);
  }
1326804
public static double normF(double[][] elements) {
    double f = 0;
    for(int i = 0; i < elements.length; i++) {
      final double[] row = elements[i];
      for(int j = 0; j < row.length; j++) {
        final double v = row[j];
        f += v * v;
      }
    }
    // TODO: detect overflow, fall back to slower hypot()
    return FastMath.sqrt(f);
  }