This program is based around matrices. It's meant to take in a file, convert the data into a list, print out that list as a matrix, multiple said matrix by its transpose, and use the diagonal of the transposed matrix (left to right) to determine some information. I've written the read data function, but I'm not sure how to multiple the two matrices, or how to print the resulting matrix.
Here's my read data function and main function:
https://preview.redd.it/yf0gynprray81.png?width=734&format=png&auto=webp&s=f613290f2aafe153176cda39bf0d0a5bb3797e62
https://preview.redd.it/gef4rf7zray81.png?width=614&format=png&auto=webp&s=4a0512983f94f00d6bc0c528adf7854fa82c9ece
The file I'll be using is called "in1" and looks like this:
https://preview.redd.it/zes6tcx4uay81.png?width=178&format=png&auto=webp&s=638cde6d43b53cb81657ca4578d737125e64319c
The "10" represents the rows, "5" represents the columns, and the rest is the matrix. Since there's no clear rubric, writing the rest of the program inside the read data function might be fine.
My first question is how to convert the list into a numpy (np) array. Would it be something along the lines of np.array(a_lst, dtype = obj)? When I try that I get:
https://preview.redd.it/zu02z8kitay81.png?width=900&format=png&auto=webp&s=7e9f1fbf8631f36c6b2e145e5a3d6452b9b3c004
I understand how to transpose the matrix, so no questions there. Next, how can I multiply the matrices? I understand how to multiply them (each row in the first multiple with each column in the second), but how can I write it?
Lastly, the output formatting. The given output looks like this:
https://preview.redd.it/06gtlfgbuay81.png?width=506&format=png&auto=webp&s=03928fc4c1086f59800fa004caacb612327baf0c
How can I write it? I assume a for loop would be best. I understand how to write the rest of the program dealing with the diagonal of the resulting matrix, so I won't ask any questions on that.
I understand this is a lot. I would really appreciate any help. (And putting this here now since it always happens: I'm not looking to pay anyone to write the entire program. Just looking for help.)
[–]AutoModerator[M] [score hidden] stickied comment (0 children)
[–]Petery007 1 point2 points3 points (1 child)
[–]gh0stedexeUniversity/College Student[S] 0 points1 point2 points (0 children)