Kronecker product: Difference between revisions

→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details
(→‎{{header|Go}}: add library solutions)
(→‎{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details)
Line 1,235:
=={{header|Kotlin}}==
{{trans|JavaScript (Imperative #2)}}
<lang scala>// version 1.1.12 (JVM)
 
typealias Matrix = Array<IntArray>
Line 1,251:
for (k in 0 until p)
for (l in 0 until q)
r[p * i + k][q * j + l] = a[i][j] * b[k][l]
return r
}
Line 1,266:
printMatrix("Kronecker product:", r)
}
 
fun main(args: Array<String>) {
var a: Matrix
Line 1,291:
intArrayOf(1, 0, 0, 1),
intArrayOf(1, 1, 1, 1)
)
r = kroneckerProduct(a, b)
printAll(a, b, r)
}</lang>