All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aparapi.examples.mdarray.DMatMul2D Maven / Gradle / Ivy

/**
 * This product currently only contains code developed by authors
 * of specific components, as identified by the source code files.
 *
 * Since product implements StAX API, it has dependencies to StAX API
 * classes.
 *
 * For additional credits (generally to people who reported problems)
 * see CREDITS file.
 */
package com.aparapi.examples.mdarray;

import com.aparapi.Kernel;

class DMatMul2D extends Kernel{
   double[][] A;

   double[][] B;

   double[][] C;

   int N;

   public DMatMul2D(double[][] A, double[][] B, double[][] C, int N) {
      this.A = A;
      this.B = B;
      this.C = C;
      this.N = N;
   }

   @Override public void run() {
      int id = getGlobalId();
      int i = id / N;
      int j = id % N;
      for (int k = 0; k < N; k++) {
         C[i][j] += A[i][k] * B[k][j];
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy