Skip to main content
added 543 characters in body
Source Link

For learning reason, you can create 2d array ~ matrix in in one row like:

matrix2 = [[0[[vc + v*10*vr for vc in range(0, v)] for vr in range(0, r)] 

Since python is a funcational language, for learning reason, you can define a map/ reduce over matrix like:

def map(matrix, r,c, fn,summ): for vr in range(0, r): for vc in range(0, c):  fn(matrix[r][c],summ) 

or with additional map-reduce over the row:

 def map(matrix, r,c, fn,fnRow,startVal,summ): for vr in range(0, r): summRow = startVal for vc in range(0, c):   fn(matrix[r][c],summRow)   fnRow(summRow, summ) 

for learning reason you could implement Strassen matrix multiplication algorithm (google please), not naive one. I doubt you learn something like that.
For doing real project, use Numpy for initiations, not for high-performance operations.

For learning reason, you can create 2d array ~ matrix in one row like:

matrix2 = [[0 for vc in range(0, v)] for vr in range(0, r)] 

Since python is a funcational language, for learning reason, you can define a map/ reduce over matrix like:

def map(matrix, r,c, fn): for vr in range(0, r): for vc in range(0, c): fn(matrix[r][c]) 

For learning reason, you can create 2d array in one row like:

matrix2 = [[vc + v*10*vr for vc in range(0, v)] for vr in range(0, r)] 

Since python is a funcational language, for learning reason, you can define a map/ reduce over matrix like:

def map(matrix, r,c, fn,summ): for vr in range(0, r): for vc in range(0, c):  fn(matrix[r][c],summ) 

or with additional map-reduce over the row:

 def map(matrix, r,c, fn,fnRow,startVal,summ): for vr in range(0, r): summRow = startVal for vc in range(0, c):   fn(matrix[r][c],summRow)   fnRow(summRow, summ) 

for learning reason you could implement Strassen matrix multiplication algorithm (google please), not naive one. I doubt you learn something like that.
For doing real project, use Numpy for initiations, not for high-performance operations.

Source Link

For learning reason, you can create 2d array ~ matrix in one row like:

matrix2 = [[0 for vc in range(0, v)] for vr in range(0, r)] 

Since python is a funcational language, for learning reason, you can define a map/ reduce over matrix like:

def map(matrix, r,c, fn): for vr in range(0, r): for vc in range(0, c): fn(matrix[r][c])