com.syncleus.aparapi.examples.mdarray.SMatMul3D Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aparapi-examples Show documentation
Show all versions of aparapi-examples Show documentation
A collection of examples for the aparapi framework.
The newest version!
/**
* 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.syncleus.aparapi.examples.mdarray;
import com.syncleus.aparapi.Kernel;
class SMatMul3D extends Kernel{
short[][][] A;
short[][][] B;
short[][][] C;
int N;
public SMatMul3D(short[][][] A, short[][][] B, short[][][] 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 * N);
int j = (id / N) % N;
int k = id % N;
for (int l = 0; l < N; l++) {
C[i][j][k] += (short) (A[i][j][l] * B[l][j][k]);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy