Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.

What I have tried:

I have been trying to correspondingly multiply the dictionary values in the form of
Python
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!
Posted
Comments
Rahul VB 27-Mar-19 10:58am    
Can you please elaborate? Do you mean, that you have a dictionary and you multiply the values extracted from those keys with another set of values?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900