Query acceleration


#1

Greetings, dear SciDB community!

I am trying to come up with more convenient way of masked weighted average operation: the input is source 3D array, 3D array of weights and 2D array - mask. Right now I multiply first two arrays elementwise, then I aggregate results into 2D array and then I multiply it with mask. My main concern is that I don’t need to perform any of those actions for elements that correspond to 0-elements from mask, and that’s why I think I can accelerate this query.

Do you have any ideas on how I can do it?

Thank you!
Best regards,
Evgeny Pozdeev.


#2

@yevgeniy

First, how about we try to simplify the problem by reducing the dimension a bit? So

  • 2D source array
  • 2D weights array
  • 1D mask
# 2D source array
# A
2 8 7
7 1 2

# 2D weights array
# B
5 2 3
9 3 2
1 2 3

# 1D mask 1 3 4
# C
0 1 1

Would you would want the result as the following?

rowsum(A.*B).*C

where .* is element-wise multiplication?