c-programming

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e9a4f899bb71fb7143309c8f880a01e0134cba56
parent d2ab03772cfccbac849b1e2ad8e4f7353be94d2d
Author: Andrew Laack <andrew@laack.co>
Date:   Tue, 16 Dec 2025 16:18:39 -0600

Basic

Diffstat:
Acomparisons/mat-mul.py | 43+++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+), 0 deletions(-)

diff --git a/comparisons/mat-mul.py b/comparisons/mat-mul.py @@ -0,0 +1,43 @@ +import random + +x = 400 # rows +y = 400 # columns + + +def init(x,y): + first = [] + for _ in range(0,x): + current = [] + for _ in range(0,y): + current.append(random.random()) + first.append(current) + return first + +first = init(x,y) +second = init(x,y) + +def dp(first, second): + s = 0 + for i in range(0, len(first)): + s += first[i] * second[i] + return s + + +res = [] + +for row_index in range(0,x): + current_row = [] + for col_index in range(0,y): + + row = first[row_index] + + column = [] + for i in range(len(second)): + column.append(second[i][col_index]) + + + current_row.append( dp(row,column)) + + res.append(current_row) + +print(res)