Java Float Number Mod module(float[] vector)

Here you can find the source of module(float[] vector)

Description

module

License

Open Source License

Declaration

public static float module(float[] vector) 

Method Source Code

//package com.java2s;
/*/*  w w  w. j a v  a 2  s . c  o m*/
 * Copyright (c) 2008-2013 Maksim Khadkevich and Fondazione Bruno Kessler.
 *
 * This file is part of MART.
 * MART is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2, as published
 * by the Free Software Foundation.
 *
 * MART is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with MART; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

public class Main {
    public static float module(float[] vector) {
        float out = 0;
        for (int i = 0; i < vector.length; i++) {
            out += vector[i] * vector[i];
        }
        return (float) Math.sqrt(out);
    }
}

Related

  1. mod(float a, float b)
  2. mod(float a, float b)
  3. mod(float a, float b)
  4. mod(float dividend, float quotient)
  5. mod2(float value)
  6. modulusSq(float[][] a)