How to multiply dictionary values with other values based on the dictionary's key?
giannis.dafnomilis at gmail.com
giannis.dafnomilis at gmail.com
Sat Aug 18 19:16:54 EDT 2018
I have the results of an optimization run in the form found in the following pic: https://i.stack.imgur.com/pIA7i.jpg.
How can I multiply the dictionary values of the keys FEq_(i,_j,_k,_l) with preexisting values of the form A[i,j,k,l]?
For example I want the value of key 'FEq_(0,_0,_2,_2)' multiplied with A[0,0,2,2], the value of key 'FEq_(0,_0,_4,_1)' multiplied with A[0,0,4,1] etc. for all the keys present in my specific dictionary.
I have been trying to correspondingly multiply the dictionary values in the form of
varsdict["FEq_({0},_{1},_{2},_{3})".format(i,j,k,l)]
but this is not working as the indexes do not iterate consequently over all their initial range values, they are the results of the optimization so some elements are missing. I also could not find something of a similar nature where I looked.
Thank you for the help!
More information about the Python-list
mailing list