4 lines
129 B
Groovy
4 lines
129 B
Groovy
def dotProduct = { x, y ->
|
|
assert x && y && x.size() == y.size()
|
|
[x, y].transpose().collect{ xx, yy -> xx * yy }.sum()
|
|
}
|