a dense vector represented by a value array

Solutions on MaxInterview for a dense vector represented by a value array by the best coders in the world

showing results for - "a dense vector represented by a value array"
Matilda
19 Jan 2016
1# A dense vector represented by a value array
2
3v = Vectors.dense([1.0, 2.0])
4u = Vectors.dense([3.0, 4.0])
5v + u
6# DenseVector([4.0, 6.0])
72 - v
8# DenseVector([1.0, 0.0])
9v / 2
10# DenseVector([0.5, 1.0])
11v * u
12# DenseVector([3.0, 8.0])
13u / v
14# DenseVector([3.0, 2.0])
15u % 2
16# DenseVector([1.0, 0.0])