Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Element wise computation
#1
Hello everyone

Suppose I have two arrays:
[Image: generator-matrix.png]
and
[Image: received-message.png]

And I wanted to do calculations using this equation:
[Image: operations.png]

The code that I have created so far:
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 boxplus(a, b):
    return 2 * aatanh(mt.tanh(a / 2) * mt.tanh(b / 2))

def aatanh(x):
    if x == 1:
        return mt.atanh(x - 0.0000001)
    elif x == -1:
        return mt.atanh(x + 0.0000001)
    else:
        return mt.atanh(x)

L = np.zeros(8)
Right now I am stuck on how to do the boxplus operation and put it into array L. And please forgive me if my post is in wrong location.
Reply


Messages In This Thread
Element wise computation - by divon - Apr-26-2022, 12:20 PM
RE: Element wise computation - by Gribouillis - Apr-29-2022, 08:09 AM
RE: Element wise computation - by divon - Jun-01-2022, 02:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  numpy.dot() result different with classic computation for large-size arrays geekgeek 5 2,027 Jan-25-2022, 09:45 PM
Last Post: Gribouillis
  How do I read in a Formula in Excel and convert it to do the computation in Python? JaneTan 2 2,769 Jul-07-2021, 02:06 PM
Last Post: Marbelous
  Appropriate data-structure / design for business-day relations (week/month-wise) sx999 2 2,891 Apr-23-2021, 08:09 AM
Last Post: sx999
  5 python columns, row-wise as input to a function dervast 1 2,081 Jul-17-2019, 08:53 PM
Last Post: Larz60+
  Inserting a python list into a dataframe column wise mahmoud899 0 4,327 Mar-04-2019, 11:44 PM
Last Post: mahmoud899
  Unable to locate element no such element gahhon 6 4,642 Feb-18-2019, 02:09 PM
Last Post: gahhon
  how to program robot to pass wise man puzzle steven12341234 0 2,004 Dec-02-2018, 08:31 AM
Last Post: steven12341234
  Change single element in 2D list changes every 1D element AceScottie 9 12,255 Nov-13-2017, 07:05 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020