From e6feb58f79b7fa91b35e579fd19924b3c2c3c563 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Thu, 17 Nov 2022 22:39:05 -0500 Subject: [PATCH] started code on dot --- src/main.nim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.nim b/src/main.nim index 604df7c..133a950 100644 --- a/src/main.nim +++ b/src/main.nim @@ -31,7 +31,13 @@ var m2 = newSeqWith(r2, newSeq[float](c2)) procedures.fillMatrix(m2, r2, c2) +var m = newSeqWith(0, newSeq[float](0)) # ? double check this + # TODO: calculate dot product (in procedures) +for i in countup(1, r1): + for j in countup(1, c1): + m[i-1].add( m1[i-1][j-1] * m2[j-1][i-1] + m1[i][j] * m2[j][i] ) # ? double check this + m[i-1].delete(0) # TODO: calculate cross product (in procedures) @@ -41,4 +47,4 @@ echo "\nSecond matrix is:" procedures.printMatrix(m2, r2) # TODO: print result to stdout - +procedures.printMatrix(m, r1) \ No newline at end of file