A computer-implemented method for efficiently performing a message passing algorithm, the method comprising: using a computer to perform the following: for each node i in a message passing algorithm, iteratively: for each node j linked to node i: - combine incoming messages to form an intermediate vector I - determining an output message vector M by: - considering an auxiliary seed vector S; a pairwise function r = d(x,y), where r,x,y are real numbers; and an index distance Δ ≥ 2^floor(log2), N being the length of message vector M and the seed vector S - initializing S as S(m) = m for each element m of vector S, - for each index p of the vector I and while Δ>0, computing in parallel, by: - considering the set of all indices at index distance Δ from given index p, for every index k belonging to this set, computing its distance from p using the function: d(p,k) + I(S(k)) in order to determine the minimum distance, - computing S(p) = S(n), n being the index corresponding to this minimum distance, and - computing Δ=floor(Δ/2), - determining the message vector M by computing M(m) = I(S(m))+d(m,S(m)) for each element m of vector M, - communicating the vector M to node i. using a computer to perform the following: for each node i in a message passing algorithm, iteratively: for each node j linked to node i: - combine incoming messages to form an intermediate vector I - determining an output message vector M by: - considering an auxiliary seed vector S; a pairwise function r = d(x,y), where r,x,y are real numbers; and an index distance Δ ≥ 2^floor(log2), N being the length of message vector M and the seed vector S - initializing S as S(m) = m for each element m of vector S, - for each index p of the vector I and while Δ>0, computing in parallel, by: - considering the set of all indices at index distance Δ from given index p, for every index k belonging to this set, computing its distance from p using the function: d(p,k) + I(S(k)) in order to determine the minimum distance, - computing S(p) = S(n), n being the index corresponding to this minimum distance, and - computing Δ=floor(Δ/2), - determining the message vector M by computing M(m) = I(S(m))+d(m,S(m)) for each element m of vector M, - communicating the vector M to node i. for each node i in a message passing algorithm, iteratively: for each node j linked to node i: - combine incoming messages to form an intermediate vector I - determining an output message vector M by: - considering an auxiliary seed vector S; a pairwise function r = d(x,y), where r,x,y are real numbers; and an index distance Δ ≥ 2^floor(log2), N being the length of message vector M and the seed vector S - initializing S as S(m) = m for each element m of vector S, - for each index p of the vector I and while Δ>0, computing in parallel, by: - considering the set of all indices at index distance Δ from given index p, for every index k belonging to this set, computing its distance from p using the function: d(p,k) + I(S(k)) in order to determine the minimum distance, - computing S(p) = S(n), n being the index corresponding to this minimum distance, and - computing Δ=floor(Δ/2), - determining the message vector M by computing M(m) = I(S(m))+d(m,S(m)) for each element m of vector M, - communicating the vector M to node i. - combine incoming messages to form an intermediate vector I - determining an output message vector M by: - considering an auxiliary seed vector S; a pairwise function r = d(x,y), where r,x,y are real numbers; and an index distance Δ ≥ 2^floor(log2), N being the length of message vector M and the seed vector S - initializing S as S(m) = m for each element m of vector S, - for each index p of the vector I and while Δ>0, computing in parallel, by: - considering the set of all indices at index distance Δ from given index p, for every index k belonging to this set, computing its distance from p using the function: d(p,k) + I(S(k)) in order to determine the minimum distance, - computing S(p) = S(n), n being the index corresponding to this minimum distance, and - computing Δ=floor(Δ/2), - considering an auxiliary seed vector S; a pairwise function r = d(x,y), where r,x,y are real numbers; and an index distance Δ ≥ 2^floor(log2), N being the length of message vector M and the seed vector S - initializing S as S(m) = m for each element m of vector S, - for each index p of the vector I and while Δ>0, computing in parallel, by: - considering the set of all indices at index distance Δ from given index p, for every index k belonging to this set, computing its distance from p using the function: d(p,k) + I(S(k)) in order to determine the minimum distance, - computing S(p) = S(n), n being the index corresponding to this minimum distance, and - computing Δ=floor(Δ/2), - considering the set of all indices at index distance Δ from given index p, for every index k belonging to this set, computing its distance from p using the function: d(p,k) + I(S(k)) in order to determine the minimum distance, - computing S(p) = S(n), n being the index corresponding to this minimum distance, and - computing Δ=floor(Δ/2), - determining the message vector M by computing M(m) = I(S(m))+d(m,S(m)) for each element m of vector M, - communicating the vector M to node i.