(Apr-29-2022, 08:09 AM)Gribouillis Wrote: I would try something like this:
import numpy as np import math as mt G = np.array([[1, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 1, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0], [1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1]]) r = np.array([-56.53511658, -96.6740462, -85.23212419, -90.05029513, -86.19336384, -79.31883055, -67.7323369, -86.49784743]) def main(): s = r.reshape((1, len(r))) print(s) M = G * s.T print(M) tmp = np.tanh(M*0.5) print(tmp) p = np.prod(tmp, axis=0) print(p) print(2 * np.arctanh(p)) if __name__ == '__main__': main()The numerical result is deceiving however, due to the large values in the array r
Note that the boxplus operator returns 0 as soon as one of the arguments is 0, and the matrix G contains many zeroes.
Output:[[-56.53511658 -96.6740462 -85.23212419 -90.05029513 -86.19336384 -79.31883055 -67.7323369 -86.49784743]] paillasse/pf/numbox.py:17: RuntimeWarning: divide by zero encountered in arctanh [[-56.53511658 -0. -0. -0. -0. -0. -0. -0. ] [-96.6740462 -96.6740462 -0. -0. -0. -0. -0. -0. ] print(2 * np.arctanh(p)) [-85.23212419 -0. -85.23212419 -0. -0. -0. -0. -0. ] [-90.05029513 -90.05029513 -90.05029513 -90.05029513 -0. -0. -0. -0. ] [-86.19336384 -0. -0. -0. -86.19336384 -0. -0. -0. ] [-79.31883055 -79.31883055 -0. -0. -79.31883055 -79.31883055 -0. -0. ] [-67.7323369 -0. -67.7323369 -0. -67.7323369 -0. -67.7323369 -0. ] [-86.49784743 -86.49784743 -86.49784743 -86.49784743 -86.49784743 -86.49784743 -86.49784743 -86.49784743]] [[-1. -0. -0. -0. -0. -0. -0. -0.] [-1. -1. -0. -0. -0. -0. -0. -0.] [-1. -0. -1. -0. -0. -0. -0. -0.] [-1. -1. -1. -1. -0. -0. -0. -0.] [-1. -0. -0. -0. -1. -0. -0. -0.] [-1. -1. -0. -0. -1. -1. -0. -0.] [-1. -0. -1. -0. -1. -0. -1. -0.] [-1. -1. -1. -1. -1. -1. -1. -1.]] [1. 0. 0. 0. 0. 0. 0. 0.] [inf 0. 0. 0. 0. 0. 0. 0.]
Thank you very much for your help, @Gribouillis. It gives me a new perspective on the problem. And please forgive me for being so late in replying to your post.