Element-wise <b>multiplication</b> of a vector with a scalar
967753
public static function muls(array $m1, float $m2): array
    {
        $res = [];
        foreach ($m1 as $val) {
            $res[] = $val * $m2;
        }

        return $res;
    }
1002022
def cross(self, vec):
        """"""
        if not isinstance(vec, Vector3Array):
            raise TypeError('Cross product operand must be a Vector3Array')
        if self.nV != 1 and vec.nV != 1 and self.nV != vec.nV:
            raise ValueError('Cross product operands must have the same '
                             'number of elements.')
        return Vector3Array(np.cross(self, vec))
1008162
public double[] homogeneRelativeVector(double[] v) {
    assert (v.length == dim);
    // TODO: this only works properly when trans[dim][dim] == 1.0, right?
    double[] dv = Arrays.copyOf(v, dim + 1);
    dv[dim] = 0.0;
    return dv;
  }
100563
def _multiply(self, x1, x2, out):
        """"""
        self.tspace._multiply(x1.tensor, x2.tensor, out.tensor)
515302
def multiply(a, col):
    """"""
    a = a.reshape(4, 4, 4)
    col = col.reshape(4, 8)
    return fcat(
        rowxcol(a[0], col),
        rowxcol(a[1], col),
        rowxcol(a[2], col),
        rowxcol(a[3], col),
    )
1126503
public Vector3f div(float scalar, Vector3f dest) {
        float inv = 1.0f / scalar;
        dest.x = x * inv;
        dest.y = y * inv;
        dest.z = z * inv;
        return dest;
    }
576669
function flatten(matrix) {
    const res = [];

    // If the given matrix is not a matrix but a scalar.
    if (!Array.isArray(matrix)) {
        matrix = [
            [matrix]
        ];
    }

    matrix.forEach((row) => {
        // If the given matrix is a vector.
        if (!Array.isArray(row)) {
            row = [row];
        }

        row.forEach((elem) => {
            res.push(elem.real);
            res.push(elem.imag);
        });
    });
    return res;
}
641580
def reduce(vector):
        
        if type(vector) is list: # matrix
            return array(list(map(multiply.reduce, vector)))
        else:
            return reduce(operator.mul, vector)
1149120
def matrix_multiplication_blockwise(self, matrix, blocksize):
        
        #Create the blockwise version of self and matrix
        selfBlockwise = self.matrix_to_blockmatrix(blocksize)
        matrixBlockwise = matrix.matrix_to_blockmatrix(blocksize)

        return (selfBlockwise * matrixBlockwise).flatten()
828986
def transform(self, vector):
        
        if isinstance(vector, RDD):
            vector = vector.map(_convert_to_vector)

        else:
            vector = _convert_to_vector(vector)
        return callMLlibFunc("elementwiseProductVector", self.scalingVector, vector)
653163
public Vector3i mul(int scalar, Vector3i dest) {
        dest.x = x * scalar;
        dest.y = y * scalar;
        dest.z = z * scalar;
        return dest;
    }
1238768
public static void mult(int size, DoubleVector x, DoubleMatrix A, 
		DoubleVector y, boolean isTransposed) {
	// isTransposed = false:	x = A * y
	// isTransposed = true:		x^t = y^t * A^t
	
	int i, j;
	
	if (!isTransposed) {
	    // for beta
	    // x = A * y
	    for (i = 0; i < size; i++) {	
		x.vect[i] = 0;
		for (j = 0; j < size; j++) {
		    x.vect[i] += A.mtrx[i][j] * y.vect[j];
		}
	    }
	    
	} else {
	    // for alpha
	    // x^t = y^t * A^t
	    for (i = 0; i < size; i++) {
		x.vect[i] = 0;
		for (j = 0; j < size; j++) {
		    x.vect[i] += y.vect[j] * A.mtrx[j][i];
		}
	    }	    
	}	
    }
924738
def mul(a, b):
  
  def multiply(a, b):
    """Multiplication"""
    return a * b
  return op_with_scalar_cast(a, b, multiply)
409635
public Vec multiply(Vec b)
    {
        DenseVector result = new  DenseVector(rows());
        multiply(b, 1.0, result);
        return result;
    }
183701
public Vector multiply(Vector vec) {
        x *= vec.x;
        y *= vec.y;
        z *= vec.z;
        return this;
    }
1316091
private static double dotProduct(DoubleVector u,
                                     DoubleVector v) {
        double dot = 0;
        for (int i = 0; i < u.length(); ++i) {
            double a = u.get(i);
            double b = v.get(i);
            dot += u.get(i) * v.get(i);
        }
        return dot;
    }
718811
public static double elementSumAbs( DMatrixD1 mat ) {
        double total = 0;

        int size = mat.getNumElements();

        for( int i = 0; i < size; i++ ) {
            total += Math.abs(mat.get(i));
        }

        return total;
    }