Multiply a vector by a scalar. - Android java.lang

Android examples for java.lang:Math Vector

Description

Multiply a vector by a scalar.

Demo Code


//package com.java2s;

public class Main {
    /**/*  w  w  w.java2s .c o  m*/
     * Multiply a vector by a scalar.  <b>Modifies the input vector</b>
     * @param vector The vector 
     * @param scalar The scalar
     **/
    public static void multiply(int size, float[] vector, int offset,
            float scalar) {
        for (int i = 0; i < size; i++)
            vector[offset + i] *= scalar;
    }
}

Related Tutorials