I have a matrix
1 2 3
4 5 6
7 8 9
I want to combine the first element with the other element of the same matrix and create new matrix.
x and y is ndarray I want to do this code in python
for i=0 to 3 do
for j=0 to 3 do
if x[0][0]<x[i][j] then
t[i][j]=1
else
t[i][j]=0
In python:
x=np.array([[1,2,3], [4,5,6], [7,8,9]])
y=[]
for i in range(0, 3):
for j in range(0, 3):
if x[0][0]< x[i][j]:
y.append(1)
else:
y.append(0)
out put:
>>> t
[0, 1, 1, 1, 1, 1, 1, 1, 1]
Is this statement correct ?