class MatrixMultiplication {
def singleThreadedMultiplication(m1:Seq[Array[Double]], m2:Array[Array[Double]] ) ={
val res = Array.fill(m1.length, m2(0).length)(0.0)
for(row <- 0 until m1.length;
col <- 0 until m2(0).length;
i <- 0 until m1(0).length){
res(row)(col) += m1(row)(i) * m2(i)(col)
}
res
}
}
__
object multiplication {
def main(args : Seq[Array[Double]], args2 : Array[Double]) : Unit = {
val matrixmult = new MatrixMultiplication
var b = new Array[Double](4)
b = Array(2,1,2,1)
seq: Seq[Double] = WrappedArray(1, 0, 2, 0)
matrixmult.singleThreadedMultiplication(Seq[Double],b)
}
}
我只需要知道如何运行单线程乘法方法,因为它的第一个参数是Seq[Array[Double]]
,我不知道,我也没有设法找到如何在第二类中创建 seq double 数组的任何方法。