python
复制代码
import numpy as np
np.set_printoptions(suppress=True, precision=3)
class GetRowColumn(object):
def __init__(self, in_row, in_column, in_matrix):
self.row = in_row
self.column = in_column
self.matrix = in_matrix
self.m_row, self.m_column = np.shape(self.matrix)
self._result = np.zeros_like(self.matrix)
self._set_zeros = np.zeros_like(self.matrix)
@property
def result(self):
my_zeros_row = np.zeros((self.m_row, self.m_row))
my_zeros_row[self.row, self.row] = 1
my_rows = my_zeros_row @ self.matrix
my_zeros_column = np.zeros((self.m_column, self.m_column))
my_zeros_column[self.column, self.column] = 1
my_columns = self.matrix @ my_zeros_column
my_one = np.zeros_like(self.matrix)
my_one[self.row, self.column] = self.matrix[self.row, self.column]
my_result = my_rows + my_columns - my_one
self._result = my_result
return self._result
@property
def set_zeros(self):
my_matrix = self.matrix
my_result = self.result
my_set_zeros = my_matrix - my_result
self._set_zeros = my_set_zeros
return self._set_zeros
if __name__ == "__main__":
my_code = 0
test_row = 5
test_column = 8
test_range = test_row * test_column
my_array = np.arange(test_range).reshape(test_row, test_column)
for i in range(1, test_row):
for j in range(1, test_column):
my_test = GetRowColumn(i, j, my_array)
result = my_test.result
set_zeros = my_test.set_zeros
print(f"*" * 50)
print(f"my_array = \n{my_array}")
print(f"result[{i},{j}]=\n{result}")
print(f"set_zeros[{i},{j}]=\n{set_zeros}")
print(f"*" * 50)
python
复制代码
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[1,1]=
[[ 0. 1. 0. 0. 0. 0. 0. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 15.]
[ 0. 17. 0. 0. 0. 0. 0. 0.]
[ 0. 25. 0. 0. 0. 0. 0. 0.]
[ 0. 33. 0. 0. 0. 0. 0. 0.]]
set_zeros[1,1]=
[[ 0. 0. 2. 3. 4. 5. 6. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[16. 0. 18. 19. 20. 21. 22. 23.]
[24. 0. 26. 27. 28. 29. 30. 31.]
[32. 0. 34. 35. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[1,2]=
[[ 0. 0. 2. 0. 0. 0. 0. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 15.]
[ 0. 0. 18. 0. 0. 0. 0. 0.]
[ 0. 0. 26. 0. 0. 0. 0. 0.]
[ 0. 0. 34. 0. 0. 0. 0. 0.]]
set_zeros[1,2]=
[[ 0. 1. 0. 3. 4. 5. 6. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[16. 17. 0. 19. 20. 21. 22. 23.]
[24. 25. 0. 27. 28. 29. 30. 31.]
[32. 33. 0. 35. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[1,3]=
[[ 0. 0. 0. 3. 0. 0. 0. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 15.]
[ 0. 0. 0. 19. 0. 0. 0. 0.]
[ 0. 0. 0. 27. 0. 0. 0. 0.]
[ 0. 0. 0. 35. 0. 0. 0. 0.]]
set_zeros[1,3]=
[[ 0. 1. 2. 0. 4. 5. 6. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[16. 17. 18. 0. 20. 21. 22. 23.]
[24. 25. 26. 0. 28. 29. 30. 31.]
[32. 33. 34. 0. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[1,4]=
[[ 0. 0. 0. 0. 4. 0. 0. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 15.]
[ 0. 0. 0. 0. 20. 0. 0. 0.]
[ 0. 0. 0. 0. 28. 0. 0. 0.]
[ 0. 0. 0. 0. 36. 0. 0. 0.]]
set_zeros[1,4]=
[[ 0. 1. 2. 3. 0. 5. 6. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[16. 17. 18. 19. 0. 21. 22. 23.]
[24. 25. 26. 27. 0. 29. 30. 31.]
[32. 33. 34. 35. 0. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[1,5]=
[[ 0. 0. 0. 0. 0. 5. 0. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 15.]
[ 0. 0. 0. 0. 0. 21. 0. 0.]
[ 0. 0. 0. 0. 0. 29. 0. 0.]
[ 0. 0. 0. 0. 0. 37. 0. 0.]]
set_zeros[1,5]=
[[ 0. 1. 2. 3. 4. 0. 6. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[16. 17. 18. 19. 20. 0. 22. 23.]
[24. 25. 26. 27. 28. 0. 30. 31.]
[32. 33. 34. 35. 36. 0. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[1,6]=
[[ 0. 0. 0. 0. 0. 0. 6. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 15.]
[ 0. 0. 0. 0. 0. 0. 22. 0.]
[ 0. 0. 0. 0. 0. 0. 30. 0.]
[ 0. 0. 0. 0. 0. 0. 38. 0.]]
set_zeros[1,6]=
[[ 0. 1. 2. 3. 4. 5. 0. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[16. 17. 18. 19. 20. 21. 0. 23.]
[24. 25. 26. 27. 28. 29. 0. 31.]
[32. 33. 34. 35. 36. 37. 0. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[1,7]=
[[ 0. 0. 0. 0. 0. 0. 0. 7.]
[ 8. 9. 10. 11. 12. 13. 14. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 39.]]
set_zeros[1,7]=
[[ 0. 1. 2. 3. 4. 5. 6. 0.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[16. 17. 18. 19. 20. 21. 22. 0.]
[24. 25. 26. 27. 28. 29. 30. 0.]
[32. 33. 34. 35. 36. 37. 38. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[2,1]=
[[ 0. 1. 0. 0. 0. 0. 0. 0.]
[ 0. 9. 0. 0. 0. 0. 0. 0.]
[16. 17. 18. 19. 20. 21. 22. 23.]
[ 0. 25. 0. 0. 0. 0. 0. 0.]
[ 0. 33. 0. 0. 0. 0. 0. 0.]]
set_zeros[2,1]=
[[ 0. 0. 2. 3. 4. 5. 6. 7.]
[ 8. 0. 10. 11. 12. 13. 14. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[24. 0. 26. 27. 28. 29. 30. 31.]
[32. 0. 34. 35. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[2,2]=
[[ 0. 0. 2. 0. 0. 0. 0. 0.]
[ 0. 0. 10. 0. 0. 0. 0. 0.]
[16. 17. 18. 19. 20. 21. 22. 23.]
[ 0. 0. 26. 0. 0. 0. 0. 0.]
[ 0. 0. 34. 0. 0. 0. 0. 0.]]
set_zeros[2,2]=
[[ 0. 1. 0. 3. 4. 5. 6. 7.]
[ 8. 9. 0. 11. 12. 13. 14. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[24. 25. 0. 27. 28. 29. 30. 31.]
[32. 33. 0. 35. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[2,3]=
[[ 0. 0. 0. 3. 0. 0. 0. 0.]
[ 0. 0. 0. 11. 0. 0. 0. 0.]
[16. 17. 18. 19. 20. 21. 22. 23.]
[ 0. 0. 0. 27. 0. 0. 0. 0.]
[ 0. 0. 0. 35. 0. 0. 0. 0.]]
set_zeros[2,3]=
[[ 0. 1. 2. 0. 4. 5. 6. 7.]
[ 8. 9. 10. 0. 12. 13. 14. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[24. 25. 26. 0. 28. 29. 30. 31.]
[32. 33. 34. 0. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[2,4]=
[[ 0. 0. 0. 0. 4. 0. 0. 0.]
[ 0. 0. 0. 0. 12. 0. 0. 0.]
[16. 17. 18. 19. 20. 21. 22. 23.]
[ 0. 0. 0. 0. 28. 0. 0. 0.]
[ 0. 0. 0. 0. 36. 0. 0. 0.]]
set_zeros[2,4]=
[[ 0. 1. 2. 3. 0. 5. 6. 7.]
[ 8. 9. 10. 11. 0. 13. 14. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[24. 25. 26. 27. 0. 29. 30. 31.]
[32. 33. 34. 35. 0. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[2,5]=
[[ 0. 0. 0. 0. 0. 5. 0. 0.]
[ 0. 0. 0. 0. 0. 13. 0. 0.]
[16. 17. 18. 19. 20. 21. 22. 23.]
[ 0. 0. 0. 0. 0. 29. 0. 0.]
[ 0. 0. 0. 0. 0. 37. 0. 0.]]
set_zeros[2,5]=
[[ 0. 1. 2. 3. 4. 0. 6. 7.]
[ 8. 9. 10. 11. 12. 0. 14. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[24. 25. 26. 27. 28. 0. 30. 31.]
[32. 33. 34. 35. 36. 0. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[2,6]=
[[ 0. 0. 0. 0. 0. 0. 6. 0.]
[ 0. 0. 0. 0. 0. 0. 14. 0.]
[16. 17. 18. 19. 20. 21. 22. 23.]
[ 0. 0. 0. 0. 0. 0. 30. 0.]
[ 0. 0. 0. 0. 0. 0. 38. 0.]]
set_zeros[2,6]=
[[ 0. 1. 2. 3. 4. 5. 0. 7.]
[ 8. 9. 10. 11. 12. 13. 0. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[24. 25. 26. 27. 28. 29. 0. 31.]
[32. 33. 34. 35. 36. 37. 0. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[2,7]=
[[ 0. 0. 0. 0. 0. 0. 0. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 15.]
[16. 17. 18. 19. 20. 21. 22. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 39.]]
set_zeros[2,7]=
[[ 0. 1. 2. 3. 4. 5. 6. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 0.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[24. 25. 26. 27. 28. 29. 30. 0.]
[32. 33. 34. 35. 36. 37. 38. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[3,1]=
[[ 0. 1. 0. 0. 0. 0. 0. 0.]
[ 0. 9. 0. 0. 0. 0. 0. 0.]
[ 0. 17. 0. 0. 0. 0. 0. 0.]
[24. 25. 26. 27. 28. 29. 30. 31.]
[ 0. 33. 0. 0. 0. 0. 0. 0.]]
set_zeros[3,1]=
[[ 0. 0. 2. 3. 4. 5. 6. 7.]
[ 8. 0. 10. 11. 12. 13. 14. 15.]
[16. 0. 18. 19. 20. 21. 22. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[32. 0. 34. 35. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[3,2]=
[[ 0. 0. 2. 0. 0. 0. 0. 0.]
[ 0. 0. 10. 0. 0. 0. 0. 0.]
[ 0. 0. 18. 0. 0. 0. 0. 0.]
[24. 25. 26. 27. 28. 29. 30. 31.]
[ 0. 0. 34. 0. 0. 0. 0. 0.]]
set_zeros[3,2]=
[[ 0. 1. 0. 3. 4. 5. 6. 7.]
[ 8. 9. 0. 11. 12. 13. 14. 15.]
[16. 17. 0. 19. 20. 21. 22. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[32. 33. 0. 35. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[3,3]=
[[ 0. 0. 0. 3. 0. 0. 0. 0.]
[ 0. 0. 0. 11. 0. 0. 0. 0.]
[ 0. 0. 0. 19. 0. 0. 0. 0.]
[24. 25. 26. 27. 28. 29. 30. 31.]
[ 0. 0. 0. 35. 0. 0. 0. 0.]]
set_zeros[3,3]=
[[ 0. 1. 2. 0. 4. 5. 6. 7.]
[ 8. 9. 10. 0. 12. 13. 14. 15.]
[16. 17. 18. 0. 20. 21. 22. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[32. 33. 34. 0. 36. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[3,4]=
[[ 0. 0. 0. 0. 4. 0. 0. 0.]
[ 0. 0. 0. 0. 12. 0. 0. 0.]
[ 0. 0. 0. 0. 20. 0. 0. 0.]
[24. 25. 26. 27. 28. 29. 30. 31.]
[ 0. 0. 0. 0. 36. 0. 0. 0.]]
set_zeros[3,4]=
[[ 0. 1. 2. 3. 0. 5. 6. 7.]
[ 8. 9. 10. 11. 0. 13. 14. 15.]
[16. 17. 18. 19. 0. 21. 22. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[32. 33. 34. 35. 0. 37. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[3,5]=
[[ 0. 0. 0. 0. 0. 5. 0. 0.]
[ 0. 0. 0. 0. 0. 13. 0. 0.]
[ 0. 0. 0. 0. 0. 21. 0. 0.]
[24. 25. 26. 27. 28. 29. 30. 31.]
[ 0. 0. 0. 0. 0. 37. 0. 0.]]
set_zeros[3,5]=
[[ 0. 1. 2. 3. 4. 0. 6. 7.]
[ 8. 9. 10. 11. 12. 0. 14. 15.]
[16. 17. 18. 19. 20. 0. 22. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[32. 33. 34. 35. 36. 0. 38. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[3,6]=
[[ 0. 0. 0. 0. 0. 0. 6. 0.]
[ 0. 0. 0. 0. 0. 0. 14. 0.]
[ 0. 0. 0. 0. 0. 0. 22. 0.]
[24. 25. 26. 27. 28. 29. 30. 31.]
[ 0. 0. 0. 0. 0. 0. 38. 0.]]
set_zeros[3,6]=
[[ 0. 1. 2. 3. 4. 5. 0. 7.]
[ 8. 9. 10. 11. 12. 13. 0. 15.]
[16. 17. 18. 19. 20. 21. 0. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[32. 33. 34. 35. 36. 37. 0. 39.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[3,7]=
[[ 0. 0. 0. 0. 0. 0. 0. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 23.]
[24. 25. 26. 27. 28. 29. 30. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 39.]]
set_zeros[3,7]=
[[ 0. 1. 2. 3. 4. 5. 6. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 0.]
[16. 17. 18. 19. 20. 21. 22. 0.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]
[32. 33. 34. 35. 36. 37. 38. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[4,1]=
[[ 0. 1. 0. 0. 0. 0. 0. 0.]
[ 0. 9. 0. 0. 0. 0. 0. 0.]
[ 0. 17. 0. 0. 0. 0. 0. 0.]
[ 0. 25. 0. 0. 0. 0. 0. 0.]
[32. 33. 34. 35. 36. 37. 38. 39.]]
set_zeros[4,1]=
[[ 0. 0. 2. 3. 4. 5. 6. 7.]
[ 8. 0. 10. 11. 12. 13. 14. 15.]
[16. 0. 18. 19. 20. 21. 22. 23.]
[24. 0. 26. 27. 28. 29. 30. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[4,2]=
[[ 0. 0. 2. 0. 0. 0. 0. 0.]
[ 0. 0. 10. 0. 0. 0. 0. 0.]
[ 0. 0. 18. 0. 0. 0. 0. 0.]
[ 0. 0. 26. 0. 0. 0. 0. 0.]
[32. 33. 34. 35. 36. 37. 38. 39.]]
set_zeros[4,2]=
[[ 0. 1. 0. 3. 4. 5. 6. 7.]
[ 8. 9. 0. 11. 12. 13. 14. 15.]
[16. 17. 0. 19. 20. 21. 22. 23.]
[24. 25. 0. 27. 28. 29. 30. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[4,3]=
[[ 0. 0. 0. 3. 0. 0. 0. 0.]
[ 0. 0. 0. 11. 0. 0. 0. 0.]
[ 0. 0. 0. 19. 0. 0. 0. 0.]
[ 0. 0. 0. 27. 0. 0. 0. 0.]
[32. 33. 34. 35. 36. 37. 38. 39.]]
set_zeros[4,3]=
[[ 0. 1. 2. 0. 4. 5. 6. 7.]
[ 8. 9. 10. 0. 12. 13. 14. 15.]
[16. 17. 18. 0. 20. 21. 22. 23.]
[24. 25. 26. 0. 28. 29. 30. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[4,4]=
[[ 0. 0. 0. 0. 4. 0. 0. 0.]
[ 0. 0. 0. 0. 12. 0. 0. 0.]
[ 0. 0. 0. 0. 20. 0. 0. 0.]
[ 0. 0. 0. 0. 28. 0. 0. 0.]
[32. 33. 34. 35. 36. 37. 38. 39.]]
set_zeros[4,4]=
[[ 0. 1. 2. 3. 0. 5. 6. 7.]
[ 8. 9. 10. 11. 0. 13. 14. 15.]
[16. 17. 18. 19. 0. 21. 22. 23.]
[24. 25. 26. 27. 0. 29. 30. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[4,5]=
[[ 0. 0. 0. 0. 0. 5. 0. 0.]
[ 0. 0. 0. 0. 0. 13. 0. 0.]
[ 0. 0. 0. 0. 0. 21. 0. 0.]
[ 0. 0. 0. 0. 0. 29. 0. 0.]
[32. 33. 34. 35. 36. 37. 38. 39.]]
set_zeros[4,5]=
[[ 0. 1. 2. 3. 4. 0. 6. 7.]
[ 8. 9. 10. 11. 12. 0. 14. 15.]
[16. 17. 18. 19. 20. 0. 22. 23.]
[24. 25. 26. 27. 28. 0. 30. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[4,6]=
[[ 0. 0. 0. 0. 0. 0. 6. 0.]
[ 0. 0. 0. 0. 0. 0. 14. 0.]
[ 0. 0. 0. 0. 0. 0. 22. 0.]
[ 0. 0. 0. 0. 0. 0. 30. 0.]
[32. 33. 34. 35. 36. 37. 38. 39.]]
set_zeros[4,6]=
[[ 0. 1. 2. 3. 4. 5. 0. 7.]
[ 8. 9. 10. 11. 12. 13. 0. 15.]
[16. 17. 18. 19. 20. 21. 0. 23.]
[24. 25. 26. 27. 28. 29. 0. 31.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]]
**************************************************
**************************************************
my_array =
[[ 0 1 2 3 4 5 6 7]
[ 8 9 10 11 12 13 14 15]
[16 17 18 19 20 21 22 23]
[24 25 26 27 28 29 30 31]
[32 33 34 35 36 37 38 39]]
result[4,7]=
[[ 0. 0. 0. 0. 0. 0. 0. 7.]
[ 0. 0. 0. 0. 0. 0. 0. 15.]
[ 0. 0. 0. 0. 0. 0. 0. 23.]
[ 0. 0. 0. 0. 0. 0. 0. 31.]
[32. 33. 34. 35. 36. 37. 38. 39.]]
set_zeros[4,7]=
[[ 0. 1. 2. 3. 4. 5. 6. 0.]
[ 8. 9. 10. 11. 12. 13. 14. 0.]
[16. 17. 18. 19. 20. 21. 22. 0.]
[24. 25. 26. 27. 28. 29. 30. 0.]
[ 0. 0. 0. 0. 0. 0. 0. 0.]]
**************************************************