// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2009-2010 Gael Guennebaud // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see . #include "common.h" int EIGEN_BLAS_FUNC(gemv)(char *opa, int *m, int *n, RealScalar *palpha, RealScalar *pa, int *lda, RealScalar *pb, int *incb, RealScalar *pbeta, RealScalar *pc, int *incc) { typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int , Scalar *, int, Scalar); static functype func[4]; static bool init = false; if(!init) { for(int k=0; k<4; ++k) func[k] = 0; func[NOTR] = (internal::general_matrix_vector_product::run); func[TR ] = (internal::general_matrix_vector_product::run); func[ADJ ] = (internal::general_matrix_vector_product::run); init = true; } Scalar* a = reinterpret_cast(pa); Scalar* b = reinterpret_cast(pb); Scalar* c = reinterpret_cast(pc); Scalar alpha = *reinterpret_cast(palpha); Scalar beta = *reinterpret_cast(pbeta); // check arguments int info = 0; if(OP(*opa)==INVALID) info = 1; else if(*m<0) info = 2; else if(*n<0) info = 3; else if(*lda::run); func[TR | (UP << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector::run); func[ADJ | (UP << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector::run); func[NOTR | (LO << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector::run); func[TR | (LO << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector::run); func[ADJ | (LO << 2) | (NUNIT << 3)] = (internal::triangular_solve_vector::run); func[NOTR | (UP << 2) | (UNIT << 3)] = (internal::triangular_solve_vector::run); func[TR | (UP << 2) | (UNIT << 3)] = (internal::triangular_solve_vector::run); func[ADJ | (UP << 2) | (UNIT << 3)] = (internal::triangular_solve_vector::run); func[NOTR | (LO << 2) | (UNIT << 3)] = (internal::triangular_solve_vector::run); func[TR | (LO << 2) | (UNIT << 3)] = (internal::triangular_solve_vector::run); func[ADJ | (LO << 2) | (UNIT << 3)] = (internal::triangular_solve_vector::run); init = true; } Scalar* a = reinterpret_cast(pa); Scalar* b = reinterpret_cast(pb); int info = 0; if(UPLO(*uplo)==INVALID) info = 1; else if(OP(*opa)==INVALID) info = 2; else if(DIAG(*diag)==INVALID) info = 3; else if(*n<0) info = 4; else if(*lda::run); func[TR | (UP << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[ADJ | (UP << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[NOTR | (LO << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[TR | (LO << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[ADJ | (LO << 2) | (NUNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[NOTR | (UP << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[TR | (UP << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[ADJ | (UP << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[NOTR | (LO << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[TR | (LO << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector::run); func[ADJ | (LO << 2) | (UNIT << 3)] = (internal::product_triangular_matrix_vector::run); init = true; } Scalar* a = reinterpret_cast(pa); Scalar* b = reinterpret_cast(pb); int info = 0; if(UPLO(*uplo)==INVALID) info = 1; else if(OP(*opa)==INVALID) info = 2; else if(DIAG(*diag)==INVALID) info = 3; else if(*n<0) info = 4; else if(*lda res(*n); res.setZero(); int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3); if(code>=16 || func[code]==0) return 0; func[code](*n, *n, a, *lda, actual_b, 1, res.data(), 1, Scalar(1)); copy_back(res.data(),b,*n,*incb); if(actual_b!=b) delete[] actual_b; return 0; } /** GBMV performs one of the matrix-vector operations * * y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, * * where alpha and beta are scalars, x and y are vectors and A is an * m by n band matrix, with kl sub-diagonals and ku super-diagonals. */ int EIGEN_BLAS_FUNC(gbmv)(char *trans, int *m, int *n, int *kl, int *ku, RealScalar *palpha, RealScalar *pa, int *lda, RealScalar *px, int *incx, RealScalar *pbeta, RealScalar *py, int *incy) { Scalar* a = reinterpret_cast(pa); Scalar* x = reinterpret_cast(px); Scalar* y = reinterpret_cast(py); Scalar alpha = *reinterpret_cast(palpha); Scalar beta = *reinterpret_cast(pbeta); int coeff_rows = *kl+*ku+1; int info = 0; if(OP(*trans)==INVALID) info = 1; else if(*m<0) info = 2; else if(*n<0) info = 3; else if(*kl<0) info = 4; else if(*ku<0) info = 5; else if(*lda(px); Scalar* y = reinterpret_cast(py); Scalar* a = reinterpret_cast(pa); Scalar alpha = *reinterpret_cast(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