I have the following example string:
s ="1 1+i\n1-i 0"
Now I have to turn this string into a complex matrix. I am aware of the np.matrix() function but it is not designed for a complex matrix. Maybe some of you can provide me some ideas of how I can go forward. I also tried to split at \n but then I have two arrays which contain exactly one element (1 1+i & 1-i 0 ). The result should be:
np.array([[1, complex(1,1)], [complex(1, -1), 0]])
Thanks in advance!
sand=, or do you mean that you assigned the string to a variable likes = "1 1+i\n1-i 0"?matrix = np.array([[1, complex(1,1)], [complex(1, -1), 0]])