Kronecker product: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 2,879:
<lang scala> object KroneckerProduct
{
/**Get the dimensions of the input matrix*/
 
def getDimensions(matrix : Array[Array[Int]]) : (Int,Int) = {
val dimensions = matrix.map(x => x.size)
Line 2,885:
}
 
/**Compute the Kronecker product between 2 input matrixes and return the result as a matrix*/
def kroneckerProduct(matrix1 : Array[Array[Int]], matrix2 : Array[Array[Int]]) : Array[Array[Int]] = {
val (r1,c1) = getDimensions(matrix1)
Anonymous user