Here you can find the source of multiplyByScalar(double scalar, double[] vector)
Parameter | Description |
---|---|
scalar | a parameter |
vector | a parameter |
public static double[] multiplyByScalar(double scalar, double[] vector)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w .j a v a 2s . c o m*/ * Returns a new vector which is the multiplication of the given vector by a scalar. * @param scalar * @param vector * @return */ public static double[] multiplyByScalar(double scalar, double[] vector) { double[] ret = new double[vector.length]; for (int i = 0; i < vector.length; ++i) { ret[i] = scalar * vector[i]; } return ret; } }