mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-19 18:40:38 +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:
parent
1221dd90aa
commit
5e8622477b
@ -106,13 +106,13 @@ matrix(T* data, int rows, int cols, int stride)
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Map<Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> > vector(T* data, int size, int incr)
|
||||
Map<Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> > make_vector(T* data, int size, int incr)
|
||||
{
|
||||
return Map<Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> >(data, size, InnerStride<Dynamic>(incr));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Map<Matrix<T,Dynamic,1> > vector(T* data, int size)
|
||||
Map<Matrix<T,Dynamic,1> > make_vector(T* data, int size)
|
||||
{
|
||||
return Map<Matrix<T,Dynamic,1> >(data, size);
|
||||
}
|
||||
@ -124,8 +124,8 @@ T* get_compact_vector(T* x, int n, int incx)
|
||||
return x;
|
||||
|
||||
T* ret = new Scalar[n];
|
||||
if(incx<0) vector(ret,n) = vector(x,n,-incx).reverse();
|
||||
else vector(ret,n) = vector(x,n, incx);
|
||||
if(incx<0) make_vector(ret,n) = make_vector(x,n,-incx).reverse();
|
||||
else make_vector(ret,n) = make_vector(x,n, incx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -135,8 +135,8 @@ T* copy_back(T* x_cpy, T* x, int n, int incx)
|
||||
if(x_cpy==x)
|
||||
return 0;
|
||||
|
||||
if(incx<0) vector(x,n,-incx).reverse() = vector(x_cpy,n);
|
||||
else vector(x,n, incx) = vector(x_cpy,n);
|
||||
if(incx<0) make_vector(x,n,-incx).reverse() = make_vector(x_cpy,n);
|
||||
else make_vector(x,n, incx) = make_vector(x_cpy,n);
|
||||
return x_cpy;
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,10 @@ double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
|
||||
{
|
||||
if(*n<=0) return 0;
|
||||
|
||||
if(*incx==1 && *incy==1) return (vector(x,*n).cast<double>().cwiseProduct(vector(y,*n).cast<double>())).sum();
|
||||
else if(*incx>0 && *incy>0) return (vector(x,*n,*incx).cast<double>().cwiseProduct(vector(y,*n,*incy).cast<double>())).sum();
|
||||
else if(*incx<0 && *incy>0) return (vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(vector(y,*n,*incy).cast<double>())).sum();
|
||||
else if(*incx>0 && *incy<0) return (vector(x,*n,*incx).cast<double>().cwiseProduct(vector(y,*n,-*incy).reverse().cast<double>())).sum();
|
||||
else if(*incx<0 && *incy<0) return (vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(vector(y,*n,-*incy).reverse().cast<double>())).sum();
|
||||
if(*incx==1 && *incy==1) return (make_vector(x,*n).cast<double>().cwiseProduct(make_vector(y,*n).cast<double>())).sum();
|
||||
else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
|
||||
else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
|
||||
else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();
|
||||
else if(*incx<0 && *incy<0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
@ -32,13 +32,14 @@ RealScalar EIGEN_CAT(EIGEN_CAT(REAL_SCALAR_SUFFIX,SCALAR_SUFFIX),asum_)(int *n,
|
||||
|
||||
if(*n<=0) return 0;
|
||||
|
||||
if(*incx==1) return vector(x,*n).unaryExpr<scalar_norm1_op>().sum();
|
||||
else return vector(x,*n,std::abs(*incx)).unaryExpr<scalar_norm1_op>().sum();
|
||||
if(*incx==1) return make_vector(x,*n).unaryExpr<scalar_norm1_op>().sum();
|
||||
else return make_vector(x,*n,std::abs(*incx)).unaryExpr<scalar_norm1_op>().sum();
|
||||
}
|
||||
|
||||
// computes a dot product of a conjugated vector with another vector.
|
||||
int EIGEN_BLAS_FUNC(dotcw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar* pres)
|
||||
{
|
||||
// std::cerr << "_dotc " << *n << " " << *incx << " " << *incy << "\n";
|
||||
Scalar* res = reinterpret_cast<Scalar*>(pres);
|
||||
|
||||
if(*n<=0)
|
||||
@ -50,11 +51,11 @@ int EIGEN_BLAS_FUNC(dotcw)(int *n, RealScalar *px, int *incx, RealScalar *py, in
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
Scalar* y = reinterpret_cast<Scalar*>(py);
|
||||
|
||||
if(*incx==1 && *incy==1) *res = (vector(x,*n).dot(vector(y,*n)));
|
||||
else if(*incx>0 && *incy>0) *res = (vector(x,*n,*incx).dot(vector(y,*n,*incy)));
|
||||
else if(*incx<0 && *incy>0) *res = (vector(x,*n,-*incx).reverse().dot(vector(y,*n,*incy)));
|
||||
else if(*incx>0 && *incy<0) *res = (vector(x,*n,*incx).dot(vector(y,*n,-*incy).reverse()));
|
||||
else if(*incx<0 && *incy<0) *res = (vector(x,*n,-*incx).reverse().dot(vector(y,*n,-*incy).reverse()));
|
||||
if(*incx==1 && *incy==1) *res = (make_vector(x,*n).dot(make_vector(y,*n)));
|
||||
else if(*incx>0 && *incy>0) *res = (make_vector(x,*n,*incx).dot(make_vector(y,*n,*incy)));
|
||||
else if(*incx<0 && *incy>0) *res = (make_vector(x,*n,-*incx).reverse().dot(make_vector(y,*n,*incy)));
|
||||
else if(*incx>0 && *incy<0) *res = (make_vector(x,*n,*incx).dot(make_vector(y,*n,-*incy).reverse()));
|
||||
else if(*incx<0 && *incy<0) *res = (make_vector(x,*n,-*incx).reverse().dot(make_vector(y,*n,-*incy).reverse()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -72,11 +73,11 @@ int EIGEN_BLAS_FUNC(dotuw)(int *n, RealScalar *px, int *incx, RealScalar *py, in
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
Scalar* y = reinterpret_cast<Scalar*>(py);
|
||||
|
||||
if(*incx==1 && *incy==1) *res = (vector(x,*n).cwiseProduct(vector(y,*n))).sum();
|
||||
else if(*incx>0 && *incy>0) *res = (vector(x,*n,*incx).cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx<0 && *incy>0) *res = (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx>0 && *incy<0) *res = (vector(x,*n,*incx).cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
else if(*incx<0 && *incy<0) *res = (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
if(*incx==1 && *incy==1) *res = (make_vector(x,*n).cwiseProduct(make_vector(y,*n))).sum();
|
||||
else if(*incx>0 && *incy>0) *res = (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,*incy))).sum();
|
||||
else if(*incx<0 && *incy>0) *res = (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,*incy))).sum();
|
||||
else if(*incx>0 && *incy<0) *res = (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
|
||||
else if(*incx<0 && *incy<0) *res = (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -88,9 +89,9 @@ RealScalar EIGEN_CAT(EIGEN_CAT(REAL_SCALAR_SUFFIX,SCALAR_SUFFIX),nrm2_)(int *n,
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
|
||||
if(*incx==1)
|
||||
return vector(x,*n).stableNorm();
|
||||
return make_vector(x,*n).stableNorm();
|
||||
|
||||
return vector(x,*n,*incx).stableNorm();
|
||||
return make_vector(x,*n,*incx).stableNorm();
|
||||
}
|
||||
|
||||
int EIGEN_CAT(EIGEN_CAT(SCALAR_SUFFIX,REAL_SCALAR_SUFFIX),rot_)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)
|
||||
@ -102,8 +103,8 @@ int EIGEN_CAT(EIGEN_CAT(SCALAR_SUFFIX,REAL_SCALAR_SUFFIX),rot_)(int *n, RealScal
|
||||
RealScalar c = *pc;
|
||||
RealScalar s = *ps;
|
||||
|
||||
StridedVectorType vx(vector(x,*n,std::abs(*incx)));
|
||||
StridedVectorType vy(vector(y,*n,std::abs(*incy)));
|
||||
StridedVectorType vx(make_vector(x,*n,std::abs(*incx)));
|
||||
StridedVectorType vy(make_vector(y,*n,std::abs(*incy)));
|
||||
|
||||
Reverse<StridedVectorType> rvx(vx);
|
||||
Reverse<StridedVectorType> rvy(vy);
|
||||
@ -125,9 +126,8 @@ int EIGEN_CAT(EIGEN_CAT(SCALAR_SUFFIX,REAL_SCALAR_SUFFIX),scal_)(int *n, RealSca
|
||||
|
||||
// std::cerr << "__scal " << *n << " " << alpha << " " << *incx << "\n";
|
||||
|
||||
if(*incx==1) vector(x,*n) *= alpha;
|
||||
else vector(x,*n,std::abs(*incx)) *= alpha;
|
||||
if(*incx==1) make_vector(x,*n) *= alpha;
|
||||
else make_vector(x,*n,std::abs(*incx)) *= alpha;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@ int EIGEN_BLAS_FUNC(axpy)(int *n, RealScalar *palpha, RealScalar *px, int *incx,
|
||||
|
||||
if(*n<=0) return 0;
|
||||
|
||||
if(*incx==1 && *incy==1) vector(y,*n) += alpha * vector(x,*n);
|
||||
else if(*incx>0 && *incy>0) vector(y,*n,*incy) += alpha * vector(x,*n,*incx);
|
||||
else if(*incx>0 && *incy<0) vector(y,*n,-*incy).reverse() += alpha * vector(x,*n,*incx);
|
||||
else if(*incx<0 && *incy>0) vector(y,*n,*incy) += alpha * vector(x,*n,-*incx).reverse();
|
||||
else if(*incx<0 && *incy<0) vector(y,*n,-*incy).reverse() += alpha * vector(x,*n,-*incx).reverse();
|
||||
if(*incx==1 && *incy==1) make_vector(y,*n) += alpha * make_vector(x,*n);
|
||||
else if(*incx>0 && *incy>0) make_vector(y,*n,*incy) += alpha * make_vector(x,*n,*incx);
|
||||
else if(*incx>0 && *incy<0) make_vector(y,*n,-*incy).reverse() += alpha * make_vector(x,*n,*incx);
|
||||
else if(*incx<0 && *incy>0) make_vector(y,*n,*incy) += alpha * make_vector(x,*n,-*incx).reverse();
|
||||
else if(*incx<0 && *incy<0) make_vector(y,*n,-*incy).reverse() += alpha * make_vector(x,*n,-*incx).reverse();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -35,7 +35,7 @@ int EIGEN_BLAS_FUNC(copy)(int *n, RealScalar *px, int *incx, RealScalar *py, int
|
||||
|
||||
// be carefull, *incx==0 is allowed !!
|
||||
if(*incx==1 && *incy==1)
|
||||
vector(y,*n) = vector(x,*n);
|
||||
make_vector(y,*n) = make_vector(x,*n);
|
||||
else
|
||||
{
|
||||
if(*incx<0) x = x - (*n-1)*(*incx);
|
||||
@ -57,8 +57,8 @@ int EIGEN_CAT(EIGEN_CAT(i,SCALAR_SUFFIX),amax_)(int *n, RealScalar *px, int *inc
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
|
||||
DenseIndex ret;
|
||||
if(*incx==1) vector(x,*n).cwiseAbs().maxCoeff(&ret);
|
||||
else vector(x,*n,std::abs(*incx)).cwiseAbs().maxCoeff(&ret);
|
||||
if(*incx==1) make_vector(x,*n).cwiseAbs().maxCoeff(&ret);
|
||||
else make_vector(x,*n,std::abs(*incx)).cwiseAbs().maxCoeff(&ret);
|
||||
return ret+1;
|
||||
}
|
||||
|
||||
@ -66,10 +66,10 @@ int EIGEN_CAT(EIGEN_CAT(i,SCALAR_SUFFIX),amin_)(int *n, RealScalar *px, int *inc
|
||||
{
|
||||
if(*n<=0) return 0;
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
|
||||
|
||||
DenseIndex ret;
|
||||
if(*incx==1) vector(x,*n).cwiseAbs().minCoeff(&ret);
|
||||
else vector(x,*n,std::abs(*incx)).cwiseAbs().minCoeff(&ret);
|
||||
if(*incx==1) make_vector(x,*n).cwiseAbs().minCoeff(&ret);
|
||||
else make_vector(x,*n,std::abs(*incx)).cwiseAbs().minCoeff(&ret);
|
||||
return ret+1;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealSc
|
||||
{
|
||||
using std::sqrt;
|
||||
using std::abs;
|
||||
|
||||
|
||||
Scalar& a = *reinterpret_cast<Scalar*>(pa);
|
||||
Scalar& b = *reinterpret_cast<Scalar*>(pb);
|
||||
RealScalar* c = pc;
|
||||
@ -143,8 +143,8 @@ int EIGEN_BLAS_FUNC(scal)(int *n, RealScalar *palpha, RealScalar *px, int *incx)
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
Scalar alpha = *reinterpret_cast<Scalar*>(palpha);
|
||||
|
||||
if(*incx==1) vector(x,*n) *= alpha;
|
||||
else vector(x,*n,std::abs(*incx)) *= alpha;
|
||||
if(*incx==1) make_vector(x,*n) *= alpha;
|
||||
else make_vector(x,*n,std::abs(*incx)) *= alpha;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -156,12 +156,11 @@ int EIGEN_BLAS_FUNC(swap)(int *n, RealScalar *px, int *incx, RealScalar *py, int
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
Scalar* y = reinterpret_cast<Scalar*>(py);
|
||||
|
||||
if(*incx==1 && *incy==1) vector(y,*n).swap(vector(x,*n));
|
||||
else if(*incx>0 && *incy>0) vector(y,*n,*incy).swap(vector(x,*n,*incx));
|
||||
else if(*incx>0 && *incy<0) vector(y,*n,-*incy).reverse().swap(vector(x,*n,*incx));
|
||||
else if(*incx<0 && *incy>0) vector(y,*n,*incy).swap(vector(x,*n,-*incx).reverse());
|
||||
else if(*incx<0 && *incy<0) vector(y,*n,-*incy).reverse().swap(vector(x,*n,-*incx).reverse());
|
||||
if(*incx==1 && *incy==1) make_vector(y,*n).swap(make_vector(x,*n));
|
||||
else if(*incx>0 && *incy>0) make_vector(y,*n,*incy).swap(make_vector(x,*n,*incx));
|
||||
else if(*incx>0 && *incy<0) make_vector(y,*n,-*incy).reverse().swap(make_vector(x,*n,*incx));
|
||||
else if(*incx<0 && *incy>0) make_vector(y,*n,*incy).swap(make_vector(x,*n,-*incx).reverse());
|
||||
else if(*incx<0 && *incy<0) make_vector(y,*n,-*incy).reverse().swap(make_vector(x,*n,-*incx).reverse());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ RealScalar EIGEN_BLAS_FUNC(asum)(int *n, RealScalar *px, int *incx)
|
||||
|
||||
if(*n<=0) return 0;
|
||||
|
||||
if(*incx==1) return vector(x,*n).cwiseAbs().sum();
|
||||
else return vector(x,*n,std::abs(*incx)).cwiseAbs().sum();
|
||||
if(*incx==1) return make_vector(x,*n).cwiseAbs().sum();
|
||||
else return make_vector(x,*n,std::abs(*incx)).cwiseAbs().sum();
|
||||
}
|
||||
|
||||
// computes a vector-vector dot product.
|
||||
@ -33,11 +33,11 @@ Scalar EIGEN_BLAS_FUNC(dot)(int *n, RealScalar *px, int *incx, RealScalar *py, i
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
Scalar* y = reinterpret_cast<Scalar*>(py);
|
||||
|
||||
if(*incx==1 && *incy==1) return (vector(x,*n).cwiseProduct(vector(y,*n))).sum();
|
||||
else if(*incx>0 && *incy>0) return (vector(x,*n,*incx).cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx<0 && *incy>0) return (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,*incy))).sum();
|
||||
else if(*incx>0 && *incy<0) return (vector(x,*n,*incx).cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
else if(*incx<0 && *incy<0) return (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
|
||||
if(*incx==1 && *incy==1) return (make_vector(x,*n).cwiseProduct(make_vector(y,*n))).sum();
|
||||
else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,*incy))).sum();
|
||||
else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,*incy))).sum();
|
||||
else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
|
||||
else if(*incx<0 && *incy<0) return (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ Scalar EIGEN_BLAS_FUNC(nrm2)(int *n, RealScalar *px, int *incx)
|
||||
|
||||
Scalar* x = reinterpret_cast<Scalar*>(px);
|
||||
|
||||
if(*incx==1) return vector(x,*n).stableNorm();
|
||||
else return vector(x,*n,std::abs(*incx)).stableNorm();
|
||||
if(*incx==1) return make_vector(x,*n).stableNorm();
|
||||
else return make_vector(x,*n,std::abs(*incx)).stableNorm();
|
||||
}
|
||||
|
||||
int EIGEN_BLAS_FUNC(rot)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)
|
||||
@ -64,8 +64,8 @@ int EIGEN_BLAS_FUNC(rot)(int *n, RealScalar *px, int *incx, RealScalar *py, int
|
||||
Scalar c = *reinterpret_cast<Scalar*>(pc);
|
||||
Scalar s = *reinterpret_cast<Scalar*>(ps);
|
||||
|
||||
StridedVectorType vx(vector(x,*n,std::abs(*incx)));
|
||||
StridedVectorType vy(vector(y,*n,std::abs(*incy)));
|
||||
StridedVectorType vx(make_vector(x,*n,std::abs(*incx)));
|
||||
StridedVectorType vy(make_vector(y,*n,std::abs(*incy)));
|
||||
|
||||
Reverse<StridedVectorType> rvx(vx);
|
||||
Reverse<StridedVectorType> rvy(vy);
|
||||
|
@ -57,8 +57,8 @@ int EIGEN_BLAS_FUNC(hemv)(char *uplo, int *n, RealScalar *palpha, RealScalar *pa
|
||||
|
||||
if(beta!=Scalar(1))
|
||||
{
|
||||
if(beta==Scalar(0)) vector(actual_y, *n).setZero();
|
||||
else vector(actual_y, *n) *= beta;
|
||||
if(beta==Scalar(0)) make_vector(actual_y, *n).setZero();
|
||||
else make_vector(actual_y, *n) *= beta;
|
||||
}
|
||||
|
||||
if(alpha!=Scalar(0))
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ int EIGEN_BLAS_FUNC(symv) (char *uplo, int *n, RealScalar *palpha, RealScalar *p
|
||||
|
||||
if(beta!=Scalar(1))
|
||||
{
|
||||
if(beta==Scalar(0)) vector(actual_y, *n).setZero();
|
||||
else vector(actual_y, *n) *= beta;
|
||||
if(beta==Scalar(0)) make_vector(actual_y, *n).setZero();
|
||||
else make_vector(actual_y, *n) *= beta;
|
||||
}
|
||||
|
||||
int code = UPLO(*uplo);
|
||||
@ -179,7 +179,7 @@ int EIGEN_BLAS_FUNC(syr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px
|
||||
|
||||
Scalar* x_cpy = get_compact_vector(x,*n,*incx);
|
||||
Scalar* y_cpy = get_compact_vector(y,*n,*incy);
|
||||
|
||||
|
||||
int code = UPLO(*uplo);
|
||||
if(code>=2 || func[code]==0)
|
||||
return 0;
|
||||
@ -366,5 +366,3 @@ int EIGEN_BLAS_FUNC(ger)(int *m, int *n, Scalar *palpha, Scalar *px, int *incx,
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user