aboutsummaryrefslogtreecommitdiffhomepage
path: root/blas/level2_impl.h
diff options
context:
space:
mode:
authorGravatar Chen-Pang He <jdh8@ms63.hinet.net>2012-09-08 01:39:16 +0800
committerGravatar Chen-Pang He <jdh8@ms63.hinet.net>2012-09-08 01:39:16 +0800
commitb0b9b4d6b223cfbfee564427514cd6d693e1c503 (patch)
treeff3da7a5bf23f79dd48e1c3ff5e1e17ef517dab9 /blas/level2_impl.h
parent145f89cd5f8872bfe8bceae127a2421576767e08 (diff)
Implement functors for rank-1 and rank-2 update.
Diffstat (limited to 'blas/level2_impl.h')
-rw-r--r--blas/level2_impl.h46
1 files changed, 5 insertions, 41 deletions
diff --git a/blas/level2_impl.h b/blas/level2_impl.h
index 7099cf96d..f1f7371ee 100644
--- a/blas/level2_impl.h
+++ b/blas/level2_impl.h
@@ -49,7 +49,8 @@ int EIGEN_BLAS_FUNC(gemv)(char *opa, int *m, int *n, RealScalar *palpha, RealSca
int actual_m = *m;
int actual_n = *n;
- if(OP(*opa)!=NOTR)
+ int code = OP(*opa);
+ if(code!=NOTR)
std::swap(actual_m,actual_n);
Scalar* actual_b = get_compact_vector(b,actual_n,*incb);
@@ -61,7 +62,9 @@ int EIGEN_BLAS_FUNC(gemv)(char *opa, int *m, int *n, RealScalar *palpha, RealSca
else vector(actual_c, actual_m) *= beta;
}
- int code = OP(*opa);
+ if(code>=4 || func[code]==0)
+ return 0;
+
func[code](actual_m, actual_n, a, *lda, actual_b, 1, actual_c, 1, alpha);
if(actual_b!=b) delete[] actual_b;
@@ -416,42 +419,3 @@ int EIGEN_BLAS_FUNC(tbsv)(char *uplo, char *op, char *diag, int *n, int *k, Real
// return 1;
// }
-/** DGER performs the rank 1 operation
- *
- * A := alpha*x*y' + A,
- *
- * where alpha is a scalar, x is an m element vector, y is an n element
- * vector and A is an m by n matrix.
- */
-int EIGEN_BLAS_FUNC(ger)(int *m, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *py, int *incy, Scalar *pa, int *lda)
-{
- Scalar* x = reinterpret_cast<Scalar*>(px);
- Scalar* y = reinterpret_cast<Scalar*>(py);
- Scalar* a = reinterpret_cast<Scalar*>(pa);
- Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
-
- int info = 0;
- if(*m<0) info = 1;
- else if(*n<0) info = 2;
- else if(*incx==0) info = 5;
- else if(*incy==0) info = 7;
- else if(*lda<std::max(1,*m)) info = 9;
- if(info)
- return xerbla_(SCALAR_SUFFIX_UP"GER ",&info,6);
-
- if(alpha==Scalar(0))
- return 1;
-
- Scalar* x_cpy = get_compact_vector(x,*m,*incx);
- Scalar* y_cpy = get_compact_vector(y,*n,*incy);
-
- // TODO perform direct calls to underlying implementation
- matrix(a,*m,*n,*lda) += alpha * vector(x_cpy,*m) * vector(y_cpy,*n).adjoint();
-
- if(x_cpy!=x) delete[] x_cpy;
- if(y_cpy!=y) delete[] y_cpy;
-
- return 1;
-}
-
-