Computes inf-norm of vector

@param a Array of double
@return inf-norm of a
187128
public static double norm_inf(double[] a) {
    double max = Double.NEGATIVE_INFINITY;
    for (double d : a) {
      if (Math.abs(d) > max) {
        max = Math.abs(d);
      }
    }
    return max;
  }
394548
public double norm()
    {
        double t = 0;

        for (int r = 0; r < nRows; ++r) {
            double v = values[r][0];
            t += v*v;
        }

        return (double) Math.sqrt(t);
    }
494827
public static double[][] inverse(double[][] A) {
    final int rows = A.length, cols = A[0].length;
    return rows == cols //
        ? (new LUDecomposition(A, rows, cols)).inverse() //
        : (new QRDecomposition(A, rows, cols)).inverse();
  }
929085
public static double[] normalizeL2(double[] vector) {
		// compute vector 2-norm
		double norm2 = 0;
		for (int i = 0; i < vector.length; i++) {
			norm2 += vector[i] * vector[i];
		}
		norm2 = (double) Math.sqrt(norm2);

		if (norm2 == 0) {
			Arrays.fill(vector, 1);
		} else {
			for (int i = 0; i < vector.length; i++) {
				vector[i] = vector[i] / norm2;
			}
		}
		return vector;
	}
660023
public static double fastNormP(DMatrixRMaj A , double p ) {
        if( p == 1 ) {
            return normP1(A);
        } else if( p == 2 ) {
            return fastNormP2(A);
        } else if( Double.isInfinite(p)) {
            return normPInf(A);
        }
        if( MatrixFeatures_DDRM.isVector(A) ) {
            return fastElementP(A,p);
        } else {
            throw new IllegalArgumentException("Doesn't support induced norms yet.");
        }
    }
1220233
def norm(vec):
    
    result = 0.0
    for i in range(vec.shape[0]):
        result += vec[i] ** 2
    return np.sqrt(result)
691797
public static int[] diag(int[][] a) {
    int[] rv = new int[a.length];
    for (int i = 0; i < a.length; i++) {
      rv[i] = a[i][i];
    }
    return rv;
  }
709904
public static double[] normalizeL1(double[] vector) {
		// compute vector 1-norm
		double norm1 = 0;
		for (int i = 0; i < vector.length; i++) {
			norm1 += Math.abs(vector[i]);
		}

		if (norm1 == 0) {
			Arrays.fill(vector, 1.0 / vector.length);
		} else {
			for (int i = 0; i < vector.length; i++) {
				vector[i] = vector[i] / norm1;
			}
		}
		return vector;
	}
149799
function norm(n, X, incx, offx) {
    // Euclidean norm
    // LAPACK: DNRM2

    if (n === 0.0) {
      return Math.abs(n);
    }

    var scale = 0.0;
    var ssq = 1.0;
    for (var i = 0; i < n; ++i) {
      var xi = X[offx + incx*i];
      if (xi !== 0.0) {
        var absxi = Math.abs(xi);
        if (scale < absxi) {
          var z = scale / absxi;
          ssq = 1.0 + ssq * (z * z);
          scale = absxi;
        } else {
          var z = absxi / scale;
          ssq = ssq + z * z;
        }
      }
    }
    return scale * Math.sqrt(ssq);
  }
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;
    }
723307
public static double norm(double[] vect) {
	double res = 0.0;
	for (int i = 0; i < vect.length; i++) {
	    res += vect[i] * vect[i];
	}	
	return Math.sqrt(res);
    }
524604
public static double elementMax( DMatrixSparseCSC A ) {
        if( A.nz_length == 0)
            return 0;

        // if every element is assigned a value then the first element can be a max.
        // Otherwise zero needs to be considered
        double max = A.isFull() ? A.nz_values[0] : 0;
        for(int i = 0; i < A.nz_length; i++ ) {
            double val = A.nz_values[i];
            if( val > max ) {
                max = val;
            }
        }

        return max;
    }
938346
public static double[] singularValues( DMatrixRMaj A ) {
        SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(A.numRows,A.numCols,false,true,true);

        if( svd.inputModified() ) {
            A = A.copy();
        }
        if( !svd.decompose(A)) {
            throw new RuntimeException("SVD Failed!");
        }

        double sv[] = svd.getSingularValues();
        Arrays.sort(sv,0,svd.numberOfSingularValues());

        // change the ordering to ascending
        for (int i = 0; i < sv.length/2; i++) {
            double tmp = sv[i];
            sv[i] = sv[sv.length-i-1];
            sv[sv.length-i-1] = tmp;
        }

        return sv;
    }
741886
public function norm1()
    {
        $r = 0;
 
        for ($j = 0; $j < $this->n; $j++) {
            $s = 0;
 
            for ($i = 0; $i < $this->m; $i++) {
                $s += abs($this->A[$i][$j]);
            }
 
            $r = ($r > $s) ? $r : $s;
        }
 
        return $r;
    }
946486
public static float normalizeAnglePositive (float a) {
        while (a < 0f) {
            a += TWO_PI;
        }
        while (a >= TWO_PI) {
            a -= TWO_PI;
        }
        return a;
    }
1221155
private static float[] normalize(float[] in) {
		float[] out = new float[in.length];
		for (int i = 0; i < in.length; i++) {
			out[i] = (in[i] / 255.0f);
		}
		return out;
	}
741769
public static double normalizeAngle (double a) {
        while (a < -Math.PI) {
            a += TWO_PI;
        }
        while (a >= Math.PI) {
            a -= TWO_PI;
        }
        return a;
    }