summaryrefslogtreecommitdiff
path: root/src/kernels/level2
diff options
context:
space:
mode:
authorCNugteren <web@cedricnugteren.nl>2015-09-26 16:58:03 +0200
committerCNugteren <web@cedricnugteren.nl>2015-09-26 16:58:03 +0200
commit2b56c2c60325f02bc695cbb968049cc09205c713 (patch)
tree3356b67a281d8292e893028d74a1801554ce0ef2 /src/kernels/level2
parent04d28b0420b7aef7c1bb9b6eec8b723b04e9bd9f (diff)
Added TRMV/TBMV/TPMV routines
Diffstat (limited to 'src/kernels/level2')
-rw-r--r--src/kernels/level2/xgemv.opencl67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/kernels/level2/xgemv.opencl b/src/kernels/level2/xgemv.opencl
index ab7802e5..8ed0e9e4 100644
--- a/src/kernels/level2/xgemv.opencl
+++ b/src/kernels/level2/xgemv.opencl
@@ -107,6 +107,19 @@ inline real LoadMatrixA(const __global real* restrict agm, const int x, const in
#endif
}
+ // For triangular matrices
+ #elif defined(ROUTINE_TRMV)
+ if (((parameter == 0 || parameter == 2) && y <= x) ||
+ ((parameter == 1 || parameter == 3) && x <= y)) {
+ result = agm[a_ld*y + x + a_offset];
+ if (parameter >= 2 && y == x) {
+ SetToOne(result);
+ }
+ }
+ else {
+ SetToZero(result);
+ }
+
// For symmetric/hermitian banded matrices
#elif defined(ROUTINE_HBMV) || defined(ROUTINE_SBMV)
if (parameter == 1) {
@@ -146,6 +159,35 @@ inline real LoadMatrixA(const __global real* restrict agm, const int x, const in
}
}
+ // For triangular banded matrices
+ #elif defined(ROUTINE_TBMV)
+ if (parameter == 1 || parameter == 3) {
+ if (x <= y) {
+ const int m = kl - y;
+ if (x >= y-kl && x <= y) { result = agm[a_ld*y + m + x + a_offset]; }
+ else { SetToZero(result); }
+ if (parameter >= 2 && y == x) {
+ SetToOne(result);
+ }
+ }
+ else {
+ SetToZero(result);
+ }
+ }
+ else {
+ if (x >= y) {
+ const int m = -y;
+ if (x >= y && x < y+kl+1) { result = agm[a_ld*y + m + x + a_offset]; }
+ else { SetToZero(result); }
+ if (parameter >= 2 && y == x) {
+ SetToOne(result);
+ }
+ }
+ else {
+ SetToZero(result);
+ }
+ }
+
// For symmetric/hermitian packed matrices
#elif defined(ROUTINE_HPMV) || defined(ROUTINE_SPMV)
if (parameter == 1) {
@@ -177,6 +219,31 @@ inline real LoadMatrixA(const __global real* restrict agm, const int x, const in
}
}
+ // For triangular packed matrices
+ #elif defined(ROUTINE_TPMV)
+ if (parameter == 1 || parameter == 3) {
+ if (x <= y) {
+ result = agm[((y+1)*y)/2 + x + a_offset];
+ if (parameter >= 2 && y == x) {
+ SetToOne(result);
+ }
+ }
+ else {
+ SetToZero(result);
+ }
+ }
+ else {
+ if (x >= y) {
+ result = agm[((2*a_ld-(y+1))*y)/2 + x + a_offset];
+ if (parameter >= 2 && y == x) {
+ SetToOne(result);
+ }
+ }
+ else {
+ SetToZero(result);
+ }
+ }
+
// For general matrices
#else
result = agm[a_ld*y + x + a_offset];