Java Array Normalize norm_vec(double[] vec)

Here you can find the source of norm_vec(double[] vec)

Description

norvec

License

Open Source License

Declaration

public static double[] norm_vec(double[] vec) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013 Jay Unruh, Stowers Institute for Medical Research.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 ******************************************************************************/

public class Main {
    public static double[] norm_vec(double[] vec) {
        double norm = Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2]
                * vec[2]);/*from   ww  w  .  j a  v a 2  s  .co m*/
        double[] temp = { vec[0] / norm, vec[1] / norm, vec[2] / norm };
        return temp;
    }
}

Related

  1. norm2(double[] vec)
  2. norm2(double[] vector)
  3. norm2(double[] x)
  4. norm2DoubleArray(double[] v)
  5. norm_variance(double[] array)
  6. normal0(double[] p1, double[] p2, double[] p3)
  7. normalCentralMoment(boolean[][] img, int p, int q)
  8. normalDist(double[] features, double[] avg, double[][] cov)
  9. normalForm(int[] a)