mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Rename the vector() factories defined in blas/common.h into make_vector() to prevent a possible name conflict with std::vector.
This commit is contained in:
@@ -58,8 +58,8 @@ int EIGEN_BLAS_FUNC(gemv)(char *opa, int *m, int *n, RealScalar *palpha, RealSca
|
||||
|
||||
if(beta!=Scalar(1))
|
||||
{
|
||||
if(beta==Scalar(0)) vector(actual_c, actual_m).setZero();
|
||||
else vector(actual_c, actual_m) *= beta;
|
||||
if(beta==Scalar(0)) make_vector(actual_c, actual_m).setZero();
|
||||
else make_vector(actual_c, actual_m) *= beta;
|
||||
}
|
||||
|
||||
if(code>=4 || func[code]==0)
|
||||
@@ -206,7 +206,7 @@ int EIGEN_BLAS_FUNC(gbmv)(char *trans, int *m, int *n, int *kl, int *ku, RealSca
|
||||
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
|
||||
Scalar beta = *reinterpret_cast<Scalar*>(pbeta);
|
||||
int coeff_rows = *kl+*ku+1;
|
||||
|
||||
|
||||
int info = 0;
|
||||
if(OP(*trans)==INVALID) info = 1;
|
||||
else if(*m<0) info = 2;
|
||||
@@ -218,26 +218,26 @@ int EIGEN_BLAS_FUNC(gbmv)(char *trans, int *m, int *n, int *kl, int *ku, RealSca
|
||||
else if(*incy==0) info = 13;
|
||||
if(info)
|
||||
return xerbla_(SCALAR_SUFFIX_UP"GBMV ",&info,6);
|
||||
|
||||
|
||||
if(*m==0 || *n==0 || (alpha==Scalar(0) && beta==Scalar(1)))
|
||||
return 0;
|
||||
|
||||
|
||||
int actual_m = *m;
|
||||
int actual_n = *n;
|
||||
if(OP(*trans)!=NOTR)
|
||||
std::swap(actual_m,actual_n);
|
||||
|
||||
|
||||
Scalar* actual_x = get_compact_vector(x,actual_n,*incx);
|
||||
Scalar* actual_y = get_compact_vector(y,actual_m,*incy);
|
||||
|
||||
|
||||
if(beta!=Scalar(1))
|
||||
{
|
||||
if(beta==Scalar(0)) vector(actual_y, actual_m).setZero();
|
||||
else vector(actual_y, actual_m) *= beta;
|
||||
if(beta==Scalar(0)) make_vector(actual_y, actual_m).setZero();
|
||||
else make_vector(actual_y, actual_m) *= beta;
|
||||
}
|
||||
|
||||
|
||||
MatrixType mat_coeffs(a,coeff_rows,*n,*lda);
|
||||
|
||||
|
||||
int nb = std::min(*n,(*m)+(*ku));
|
||||
for(int j=0; j<nb; ++j)
|
||||
{
|
||||
@@ -246,16 +246,16 @@ int EIGEN_BLAS_FUNC(gbmv)(char *trans, int *m, int *n, int *kl, int *ku, RealSca
|
||||
int len = end - start + 1;
|
||||
int offset = (*ku) - j + start;
|
||||
if(OP(*trans)==NOTR)
|
||||
vector(actual_y+start,len) += (alpha*actual_x[j]) * mat_coeffs.col(j).segment(offset,len);
|
||||
make_vector(actual_y+start,len) += (alpha*actual_x[j]) * mat_coeffs.col(j).segment(offset,len);
|
||||
else if(OP(*trans)==TR)
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).transpose() * vector(actual_x+start,len) ).value();
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).transpose() * make_vector(actual_x+start,len) ).value();
|
||||
else
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).adjoint() * vector(actual_x+start,len) ).value();
|
||||
}
|
||||
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).adjoint() * make_vector(actual_x+start,len) ).value();
|
||||
}
|
||||
|
||||
if(actual_x!=x) delete[] actual_x;
|
||||
if(actual_y!=y) delete[] copy_back(actual_y,y,actual_m,*incy);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ int EIGEN_BLAS_FUNC(tbmv)(char *uplo, char *opa, char *diag, int *n, int *k, Rea
|
||||
Scalar* a = reinterpret_cast<Scalar*>(pa);
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
int coeff_rows = *k + 1;
|
||||
|
||||
|
||||
int info = 0;
|
||||
if(UPLO(*uplo)==INVALID) info = 1;
|
||||
else if(OP(*opa)==INVALID) info = 2;
|
||||
@@ -283,37 +283,37 @@ int EIGEN_BLAS_FUNC(tbmv)(char *uplo, char *opa, char *diag, int *n, int *k, Rea
|
||||
else if(*incx==0) info = 9;
|
||||
if(info)
|
||||
return xerbla_(SCALAR_SUFFIX_UP"TBMV ",&info,6);
|
||||
|
||||
|
||||
if(*n==0)
|
||||
return 0;
|
||||
|
||||
|
||||
int actual_n = *n;
|
||||
|
||||
|
||||
Scalar* actual_x = get_compact_vector(x,actual_n,*incx);
|
||||
|
||||
|
||||
MatrixType mat_coeffs(a,coeff_rows,*n,*lda);
|
||||
|
||||
|
||||
int ku = UPLO(*uplo)==UPPER ? *k : 0;
|
||||
int kl = UPLO(*uplo)==LOWER ? *k : 0;
|
||||
|
||||
|
||||
for(int j=0; j<*n; ++j)
|
||||
{
|
||||
int start = std::max(0,j - ku);
|
||||
int end = std::min((*m)-1,j + kl);
|
||||
int len = end - start + 1;
|
||||
int offset = (ku) - j + start;
|
||||
|
||||
|
||||
if(OP(*trans)==NOTR)
|
||||
vector(actual_y+start,len) += (alpha*actual_x[j]) * mat_coeffs.col(j).segment(offset,len);
|
||||
make_vector(actual_y+start,len) += (alpha*actual_x[j]) * mat_coeffs.col(j).segment(offset,len);
|
||||
else if(OP(*trans)==TR)
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).transpose() * vector(actual_x+start,len) ).value();
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).transpose() * make_vector(actual_x+start,len) ).value();
|
||||
else
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).adjoint() * vector(actual_x+start,len) ).value();
|
||||
}
|
||||
|
||||
actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).adjoint() * make_vector(actual_x+start,len) ).value();
|
||||
}
|
||||
|
||||
if(actual_x!=x) delete[] actual_x;
|
||||
if(actual_y!=y) delete[] copy_back(actual_y,y,actual_m,*incy);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -362,7 +362,7 @@ int EIGEN_BLAS_FUNC(tbsv)(char *uplo, char *op, char *diag, int *n, int *k, Real
|
||||
Scalar* a = reinterpret_cast<Scalar*>(pa);
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
int coeff_rows = *k+1;
|
||||
|
||||
|
||||
int info = 0;
|
||||
if(UPLO(*uplo)==INVALID) info = 1;
|
||||
else if(OP(*op)==INVALID) info = 2;
|
||||
@@ -373,22 +373,22 @@ int EIGEN_BLAS_FUNC(tbsv)(char *uplo, char *op, char *diag, int *n, int *k, Real
|
||||
else if(*incx==0) info = 9;
|
||||
if(info)
|
||||
return xerbla_(SCALAR_SUFFIX_UP"TBSV ",&info,6);
|
||||
|
||||
|
||||
if(*n==0 || (*k==0 && DIAG(*diag)==UNIT))
|
||||
return 0;
|
||||
|
||||
|
||||
int actual_n = *n;
|
||||
|
||||
|
||||
Scalar* actual_x = get_compact_vector(x,actual_n,*incx);
|
||||
|
||||
|
||||
int code = OP(*op) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);
|
||||
if(code>=16 || func[code]==0)
|
||||
return 0;
|
||||
|
||||
func[code](*n, *k, a, *lda, actual_x);
|
||||
|
||||
|
||||
if(actual_x!=x) delete[] copy_back(actual_x,x,actual_n,*incx);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -521,4 +521,3 @@ int EIGEN_BLAS_FUNC(tpsv)(char *uplo, char *opa, char *diag, int *n, RealScalar
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user