Java Number Power pow(final double[] values, final double exp)

Here you can find the source of pow(final double[] values, final double exp)

Description

Performs termwise Math.pow(double,double) on the elements.

License

Open Source License

Parameter

Parameter Description
values a parameter
exp a parameter

Return

Newly allocated array whose elements are termwise exponentiations of the input. Side Effects: Allocation of new array

Declaration

public static final double[] pow(final double[] values, final double exp) 

Method Source Code

//package com.java2s;
/*/*from  w  w w . j ava 2  s.com*/
 * ====================================================
 * Copyright (C) 2013 by Idylwood Technologies, LLC. All rights reserved.
 *
 * Developed at Idylwood Technologies, LLC.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * The License should have been distributed to you with the source tree.
 * If not, it can be found at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author: Charles Cooper
 * Date: 2013
 * ====================================================
 */

public class Main {
    /**
     * Performs termwise Math.pow(double,double) on the elements.
     * @param values
     * @param exp
     * @return Newly allocated array whose elements are
     * termwise exponentiations of the input.
     * Side Effects: Allocation of new array
     */
    public static final double[] pow(final double[] values, final double exp) {
        final double[] ret = new double[values.length];
        for (int i = values.length; i-- != 0;)
            ret[i] = Math.pow(values[i], exp);
        return ret;
    }
}

Related

  1. pow(double x, double y)
  2. pow(double x, double y)
  3. pow(double x, int n)
  4. pow(double[] array, double exp)
  5. pow(double[][] x, int p)
  6. pow(final float a, final float b)
  7. pow(final int a, final int b)
  8. pow(final int a, final int b)
  9. pow(final int b, final int e)