Java Array Multiply multiplyVecorWithScalar(double[] v, double s)

Here you can find the source of multiplyVecorWithScalar(double[] v, double s)

Description

multiply Vecor With Scalar

License

Open Source License

Declaration

public static double[] multiplyVecorWithScalar(double[] v, double s) 

Method Source Code

//package com.java2s;
/*/*  w ww  . j  ava2  s  .com*/
 * Copyright (C) 2010 Brockmann Consult GmbH (info@brockmann-consult.de)
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 3 of the License, or (at your option)
 * any later version.
 * This program 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 this program; if not, see http://www.gnu.org/licenses/
 */

public class Main {
    public static double[] multiplyVecorWithScalar(double[] v, double s) {
        double[] res = new double[v.length];
        for (int i = 0; i < v.length; i++) {
            res[i] = s * v[i];
        }
        return res;
    }
}

Related

  1. multiplyScalarInPlace(double[] a, double value)
  2. multiplySelf(double[] dest, double source)
  3. multiplySparse(int[][][] as, int A, int[][][] bs, int B, int[][][] cs)
  4. multiplySquares(float[] mat1, float[] mat2, int sidelength)
  5. multiplyValues(byte[] array, int multiplier)
  6. multiplyVector(float[] mat, float[] vec, float[] dest)
  7. multiplyVectorByMatrix(double[] v, double[] m, double[] result)
  8. multiplyX(long[] x, long[] z)
  9. multiplyX(long[] x, long[] z)