javamatrixojalgo

Elementwise multiplication two matrices or PrimitiveDenseStores in ojAlgo


Can anyone tell me how to multiply corresponding elements of two matrices in ojAlgo? Looking for block function for c[i][j] = a[i][j] * b[i][j]


Solution

  • There are several ways to do that. Here's one alternative:

    matrixA.operateOnMatching(MULTIPLY, matrixB).supplyTo(matrixC);

    Where MULTIPLY comes from a static import (org.ojalgo.function.constant.PrimitiveMath).