I have an indexed finite set of elements $X = \{x_1,x_2,x_3,...,x_n\}$, where $x_i \in \mathbb{R}$. And a corresponding indexed finite set $A = \{a_1,a_2,a_3,...,a_n\}$, where $a_i \in [0,1]$ and a third set $B = \{b_1,b_2,b_3,...,b_n\}$, where $b_i \in [0,1]$. And $|A| = |B| = |X| = n$.
I have spent weeks simplifying my system down to the following equation: $$F = \sum^n_{i=1}\left(\prod^n_{j=1}\left(a_j\left\lfloor \frac{x_j-x_i}{|x_j-x_i|+1} \right\rfloor + 1\right)\right)b_i$$ As you can see it has 2 nested "loops", the product inside the sum, which gives it quadratic complexity. I am going to be computing this for millions of elements in realtime and a quadratically increasing number of floor functions is a no go in terms of performance, $O(n^2)$, but I need $O(n)$.
I need to simplify the above expression into an expression without nested products or sums.
What I have tried:
- Breaking up: $\prod\limits^n_{j=1}\left(a_j\left\lfloor \frac{x_j-x_i}{|x_j-x_i|+1} \right\rfloor + 1\right)$ into:
a) $\prod\limits^n_{j=1}(a_j + 1) - \text{??} = \prod\limits^n_{j=1}\left(a_j\left\lfloor \frac{x_j-x_i}{|x_j-x_i|+1} \right\rfloor + 1\right)$, but I wasn't able to get a closed form for ??. - I have tried multiply out all of F and tried just simplifying it for 2, 3, 4 elements of $X$.
- I tried building up to it
a) $F_{0} = \sum^n_{i=1}\left(\prod^n_{j=1}\left\lfloor \frac{x_j-x_i}{|x_j-x_i|+1} \right\rfloor \right) = \sum^n_{i=1}\left\lfloor \frac{(\forall x_{j} \in X, min(x_j))-x_i}{|(\forall x_{j} \in X, min(x_j))-x_i|+1} \right\rfloor $
b) $F_{1} = \sum^n_{i=1}\left(\prod^n_{j=1}a_{j}\left\lfloor \frac{x_j-x_i}{|x_j-x_i|+1} \right\rfloor \right) = (\prod^n_{j=1}a_{j})\sum^n_{i=1}\left\lfloor \frac{(\forall x_{j} \in X, min(x_j))-x_i}{|(\forall x_{j} \in X, min(x_j))-x_i|+1} \right\rfloor $
All by efforts lead to dead ends, any help would be appreciated!