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 62b2882 commit 5cf4652Copy full SHA for 5cf4652
src/main/scala/copeland.scala
@@ -8,21 +8,19 @@ case class CopelandResult(
8
)
9
10
def level_of_dominance(v1: Vec, v2: Vec): Int =
11
- var lod = 0
12
- val n = v1.length
13
- for (i <- 0 until n)
14
- if (v1(i) < v2(i))
15
- lod += 1
+ v1.zip(v2).filter((a, b) => a < b).length
16
17
- lod
18
19
def dominance_scores(ordering_mat: Mat): Mat =
+
20
val n = ordering_mat.length
21
Array.tabulate(n, n)((i, j) =>
22
level_of_dominance(ordering_mat(i), ordering_mat(j))
23
24
25
def winloss_scores(dommat: Mat): Mat =
26
val n = dommat.length
27
Array.tabulate(n, n)((i, j) => (dommat(i)(j) - dommat(j)(i)).sign)
28
0 commit comments