Home > other >  Insert about python matrix
Insert about python matrix

Time:11-11

How python will (4 x 2), (3 x 2), (1 x 2), (2 x 5), (2 x 2), (2 * 1), (3 x 1) these seven matrix insert a 5 x7 matrix, just make the matrix with, do not use the np

CodePudding user response:

 d1=[[0 for I in range (2)] for j in range (4)] 

Matrix=[[- 1 for I in range (7)] for j in range (5)]
Def func (array, sh, sw, eh, ew) :
In the range for w (sw, ew) :
In the range for h (sh, eh) :
Matrix [h] [w]=array [eh - h - 1]] [ew - w - 1
Sh=1
Sw=2
Func (d1, sh, sw, len (d1) + sh, len (d1 [0]) + sw)

Print (matrix)

CodePudding user response:

reference 1/f, happy pigs response:
 d1=[[0 for I in range (2)] for j in range (4)] 

Matrix=[[- 1 for I in range (7)] for j in range (5)]
Def func (array, sh, sw, eh, ew) :
In the range for w (sw, ew) :
In the range for h (sh, eh) :
Matrix [h] [w]=array [eh - h - 1]] [ew - w - 1
Sh=1
Sw=2
Func (d1, sh, sw, len (d1) + sh, len (d1 [0]) + sw)

Print (matrix)

If there are multiple matrix
  • Related