Skip to content

Instantly share code, notes, and snippets.

@agibsonccc
Created September 4, 2014 05:29
Show Gist options
  • Save agibsonccc/5e1319e51622e4a5cbfe to your computer and use it in GitHub Desktop.
Save agibsonccc/5e1319e51622e4a5cbfe to your computer and use it in GitHub Desktop.
public static INDArray gemv(INDArray A, INDArray B, INDArray C, float alpha, float beta) {
JCublasNDArray cA = (JCublasNDArray) A;
JCublasNDArray cB = (JCublasNDArray) B;
JCublasNDArray cC = (JCublasNDArray) C;
char trans = 'n';
if (A.rows() == B.columns()) {
trans = 'T';
}
JCublas.cublasDgemv(
'n', //trans
A.rows(), // m
A.columns(), // n
alpha, //alpha
cA.pointer(), // A
A.rows(), // lda
cB.pointer(), // x
B.rows(), // incx
beta, // beta
cC.pointer(), // y
1); // incy
cC.getData();
return C;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment