I have a numpy array of dimension 3x3 i.e. it has a total of 9 elements. I have 8 values that I would like to set and the value at location (2, 2) will always be 1. I can do it individually as follows:
import numpy as np
def set(coefs):
a = np.zeros(3,3)
a[0, 0] = coefs[0]
a[0, 1] = coefs[1]
a[0, 2] = coefs[2]
a[1, 0] = coefs[3]
...
a[2, 2] = 1
However, I was wondering if there is a more concise and general way to fill those 8 values.