Element-wise multiplication



I tried to find element-wise multiplication for arrays. Does SciDB support element-wise operations such as element-wise multiplication, division, etc?


Yes, by using join and apply instead of a native operator like matrix multiply. Here is an example:

Create two 10x10 matrices

iquery -aq "store(build(<x:double>[i=1:10,10,0,j=1:10,10,0],i+j),U)"
iquery -aq “store(build(<x:double>[i=1:10,10,0,j=1:10,10,0],i-j),V)”

Compute their Hadamard product:

iquery -aq “store(project(apply(join(U,V), y, U.x * V.x), y), W)”

The matrix W contains the entry-wise product of U and V. Any scalar operation can be used.


Hi, I just found this thread after searching quite a bit for point-wise operations on two or more arrays in SciDB.

This seems really inefficient and requires more computation than usual. Is there a more optimized function or query to able to achieve this primitive? Maybe for operations such as element-wise addition or subtraction?


For those wondering, constructing a n+1 dimension array and then flattening it using an aggregation operation is approx ~10x faster than doing joins on individual arrays.