We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfe5e55 commit c1a7ff7Copy full SHA for c1a7ff7
tests/pos/matrixOps.scala
@@ -0,0 +1,17 @@
1
+object Test with
2
+
3
+ type Matrix = Array[Array[Double]]
4
+ type Vector = Array[Double]
5
6
+ given (m: Matrix)
7
+ def nRows = m.length
8
+ def nCols = m(0).length
9
+ def row(i: Int): Vector = m(i)
10
+ def col(j: Int): Vector = Array.tabulate(m.length)(i => m(i)(j))
11
12
+ def pairwise(m: Matrix) =
13
+ for
14
+ i <- 0 until m.nRows
15
+ j <- 0 until m.nCols
16
+ yield
17
+ m.row(i).zip(m.row(j)).map(_ - _).sum
0 commit comments