I have nine lists (columns of a dataframe to be precise), and I would like to do matrix operations with all rows of these columns. For example, I need to do this operation:
O(G) = trace(G*transpose(G)) + trace(G*G), where G is a 3x3 matrix defined by each rows of the columns. For example, for two rows:
a,b,c,d,e,f,g,h,i
1,2,3,4,5,6,7,8,9
5,6,9,8,7,4,5,2,3
The two matrices should be:
G1 = [1,2,3; 4,5,6; 7,8,9] > perform O(G1) = 546
G2 = [5,6,9; 8,7,4; 5,2,3] > perform O(G2) = 594
and then, put them into a new column:
a,b,c,d,e,f,g,h,i,O
1,2,3,4,5,6,7,8,9,546
5,6,9,8,7,4,5,2,3,594
How can I proceed with this? I think numpy doesn't permit create matrices with list as values...