Java Abs abs(int pos, double[] array)

Here you can find the source of abs(int pos, double[] array)

Description

Computes the absolute value of the complex number at position pos in the array

License

Open Source License

Parameter

Parameter Description
pos the position
array the array which contains the values

Return

the absolute value

Declaration

public static double abs(int pos, double[] array) 

Method Source Code

//package com.java2s;
/*//from  w w w. ja  va 2s  . c  o m
 * Copyright (C) 2010-2014  Andreas Maier
 * CONRAD is developed as an Open Source project under the GNU General Public License (GPL).
 */

public class Main {
    /**
     * Computes the absolute value of the complex number at position pos in the array
     * @param pos the position
     * @param array the array which contains the values
     * @return the absolute value
     */
    public static double abs(int pos, double[] array) {
        return Math.sqrt(Math.pow(array[pos * 2], 2)
                + Math.pow(array[(2 * pos) + 1], 2));
    }

    /**
     * Computes the absolute values of the complex number at posx, posy in the 2D array array.
     * 
     * @param posx x position
     * @param posy y position
     * @param array the array
     * @return the absolute value of the complex number
     */
    public static double abs(int posx, int posy, double[][] array) {
        return Math.sqrt(Math.pow(array[posx][posy * 2], 2)
                + Math.pow(array[posx][(2 * posy) + 1], 2));
    }
}

Related

  1. abs(float[] items)
  2. abs(float[] values)
  3. abs(int i)
  4. abs(int n)
  5. abs(int number)
  6. abs(int val)
  7. abs(int val)
  8. abs(int value)
  9. abs(int x)