aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2014-04-01 22:07:05 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2014-04-01 22:07:05 -0700
commitaecc78325a1bd76bc02f2435fd488ef1cf6d97af (patch)
tree479504f45ec474e0a1b54a0c966287f0b7cdaf8f
parent93870d95b7b8a7716ab825d559e7af5f7f84308a (diff)
parent1cb8de12501b3db3d12774774cbbe12983243cee (diff)
Pulled the latest updates from the eigen trunk.
-rw-r--r--bench/btl/data/action_settings.txt2
-rw-r--r--bench/spbench/spbenchstyle.h3
-rw-r--r--blas/common.h12
-rw-r--r--blas/double.cpp11
-rw-r--r--blas/level1_cplx_impl.h38
-rw-r--r--blas/level1_impl.h39
-rw-r--r--blas/level1_real_impl.h22
-rw-r--r--blas/level2_cplx_impl.h4
-rw-r--r--blas/level2_impl.h77
-rw-r--r--blas/level2_real_impl.h8
-rw-r--r--blas/xerbla.cpp2
-rw-r--r--cmake/language_support.cmake3
-rw-r--r--lapack/eigenvalues.cpp4
-rw-r--r--unsupported/Eigen/src/SparseExtra/MarketIO.h6
-rw-r--r--unsupported/test/autodiff.cpp45
15 files changed, 137 insertions, 139 deletions
diff --git a/bench/btl/data/action_settings.txt b/bench/btl/data/action_settings.txt
index 674a738d9..39d2b5dc4 100644
--- a/bench/btl/data/action_settings.txt
+++ b/bench/btl/data/action_settings.txt
@@ -16,4 +16,4 @@ hessenberg ; "{/*1.5 Hessenberg decomposition}" ; "matrix size" ; 4:5000
symv ; "{/*1.5 symmetric matrix vector product}" ; "matrix size" ; 4:5000
syr2 ; "{/*1.5 symmretric rank-2 update (A += u^T v + u v^T)}" ; "matrix size" ; 4:5000
ger ; "{/*1.5 general rank-1 update (A += u v^T)}" ; "matrix size" ; 4:5000
-rot ; "{/*1.5 apply rotation in the plane}" ; "vector size" ; 4:1000000 \ No newline at end of file
+rot ; "{/*1.5 apply rotation in the plane}" ; "vector size" ; 4:1000000
diff --git a/bench/spbench/spbenchstyle.h b/bench/spbench/spbenchstyle.h
index 17a05ce71..f6a981778 100644
--- a/bench/spbench/spbenchstyle.h
+++ b/bench/spbench/spbenchstyle.h
@@ -91,4 +91,5 @@ void printBenchStyle(std::ofstream& out)
</xsl:stylesheet>\n\n";
}
-#endif \ No newline at end of file
+
+#endif
diff --git a/blas/common.h b/blas/common.h
index 2bf642c6b..c39cc63a8 100644
--- a/blas/common.h
+++ b/blas/common.h
@@ -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;
}
diff --git a/blas/double.cpp b/blas/double.cpp
index 8fd0709ba..295b1d1f2 100644
--- a/blas/double.cpp
+++ b/blas/double.cpp
@@ -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;
}
-
diff --git a/blas/level1_cplx_impl.h b/blas/level1_cplx_impl.h
index ffe192481..719f5bac9 100644
--- a/blas/level1_cplx_impl.h
+++ b/blas/level1_cplx_impl.h
@@ -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;
}
-
diff --git a/blas/level1_impl.h b/blas/level1_impl.h
index b08c2f6be..98e4c0963 100644
--- a/blas/level1_impl.h
+++ b/blas/level1_impl.h
@@ -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;
}
-
diff --git a/blas/level1_real_impl.h b/blas/level1_real_impl.h
index 8acecdfc6..02586d519 100644
--- a/blas/level1_real_impl.h
+++ b/blas/level1_real_impl.h
@@ -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);
diff --git a/blas/level2_cplx_impl.h b/blas/level2_cplx_impl.h
index b850b6cd1..afa9a7493 100644
--- a/blas/level2_cplx_impl.h
+++ b/blas/level2_cplx_impl.h
@@ -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))
diff --git a/blas/level2_impl.h b/blas/level2_impl.h
index 5f3941975..233c7b753 100644
--- a/blas/level2_impl.h
+++ b/blas/level2_impl.h
@@ -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;
}
-
diff --git a/blas/level2_real_impl.h b/blas/level2_real_impl.h
index 8d56eaaa1..9722a4674 100644
--- a/blas/level2_real_impl.h
+++ b/blas/level2_real_impl.h
@@ -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;
}
-
-
diff --git a/blas/xerbla.cpp b/blas/xerbla.cpp
index 0d57710fe..0422f79b7 100644
--- a/blas/xerbla.cpp
+++ b/blas/xerbla.cpp
@@ -1,7 +1,7 @@
#include <iostream>
-#if (defined __GNUC__)
+#if (defined __GNUC__) && (!defined __MINGW32__)
#define EIGEN_WEAK_LINKING __attribute__ ((weak))
#else
#define EIGEN_WEAK_LINKING
diff --git a/cmake/language_support.cmake b/cmake/language_support.cmake
index d687b71f6..93f8a8fd8 100644
--- a/cmake/language_support.cmake
+++ b/cmake/language_support.cmake
@@ -33,7 +33,7 @@ function(workaround_9220 language language_works)
file(WRITE ${CMAKE_BINARY_DIR}/language_tests/${language}/CMakeLists.txt
${text})
execute_process(
- COMMAND ${CMAKE_COMMAND} .
+ COMMAND ${CMAKE_COMMAND} . -G "${CMAKE_GENERATOR}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}
RESULT_VARIABLE return_code
OUTPUT_QUIET
@@ -64,3 +64,4 @@ endfunction(workaround_9220)
#message("CXX_language_works = ${CXX_language_works}")
#workaround_9220(CXXp CXXp_language_works)
#message("CXXp_language_works = ${CXXp_language_works}")
+
diff --git a/lapack/eigenvalues.cpp b/lapack/eigenvalues.cpp
index a1526ebcd..6141032ab 100644
--- a/lapack/eigenvalues.cpp
+++ b/lapack/eigenvalues.cpp
@@ -64,14 +64,14 @@ EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Sca
if(eig.info()==NoConvergence)
{
- vector(w,*n).setZero();
+ make_vector(w,*n).setZero();
if(computeVectors)
matrix(a,*n,*n,*lda).setIdentity();
//*info = 1;
return 0;
}
- vector(w,*n) = eig.eigenvalues();
+ make_vector(w,*n) = eig.eigenvalues();
if(computeVectors)
matrix(a,*n,*n,*lda) = eig.eigenvectors();
diff --git a/unsupported/Eigen/src/SparseExtra/MarketIO.h b/unsupported/Eigen/src/SparseExtra/MarketIO.h
index 7aafce928..1c40d3f7c 100644
--- a/unsupported/Eigen/src/SparseExtra/MarketIO.h
+++ b/unsupported/Eigen/src/SparseExtra/MarketIO.h
@@ -238,9 +238,9 @@ bool saveMarket(const SparseMatrixType& mat, const std::string& filename, int sy
for(int j=0; j<mat.outerSize(); ++j)
for(typename SparseMatrixType::InnerIterator it(mat,j); it; ++it)
{
- ++ count;
- internal::PutMatrixElt(it.value(), it.row()+1, it.col()+1, out);
- // out << it.row()+1 << " " << it.col()+1 << " " << it.value() << "\n";
+ ++ count;
+ internal::PutMatrixElt(it.value(), it.row()+1, it.col()+1, out);
+ // out << it.row()+1 << " " << it.col()+1 << " " << it.value() << "\n";
}
out.close();
return true;
diff --git a/unsupported/test/autodiff.cpp b/unsupported/test/autodiff.cpp
index 6eb417e8d..087e7c542 100644
--- a/unsupported/test/autodiff.cpp
+++ b/unsupported/test/autodiff.cpp
@@ -127,46 +127,47 @@ template<typename Func> void forward_jacobian(const Func& f)
VERIFY_IS_APPROX(j, jref);
}
+
+// TODO also check actual derivatives!
void test_autodiff_scalar()
{
- std::cerr << foo<float>(1,2) << "\n";
+ Vector2f p = Vector2f::Random();
typedef AutoDiffScalar<Vector2f> AD;
- AD ax(1,Vector2f::UnitX());
- AD ay(2,Vector2f::UnitY());
+ AD ax(p.x(),Vector2f::UnitX());
+ AD ay(p.y(),Vector2f::UnitY());
AD res = foo<AD>(ax,ay);
- std::cerr << res.value() << " <> "
- << res.derivatives().transpose() << "\n\n";
+ VERIFY_IS_APPROX(res.value(), foo(p.x(),p.y()));
}
+// TODO also check actual derivatives!
void test_autodiff_vector()
{
- std::cerr << foo<Vector2f>(Vector2f(1,2)) << "\n";
+ Vector2f p = Vector2f::Random();
typedef AutoDiffScalar<Vector2f> AD;
typedef Matrix<AD,2,1> VectorAD;
- VectorAD p(AD(1),AD(-1));
- p.x().derivatives() = Vector2f::UnitX();
- p.y().derivatives() = Vector2f::UnitY();
+ VectorAD ap = p.cast<AD>();
+ ap.x().derivatives() = Vector2f::UnitX();
+ ap.y().derivatives() = Vector2f::UnitY();
- AD res = foo<VectorAD>(p);
- std::cerr << res.value() << " <> "
- << res.derivatives().transpose() << "\n\n";
+ AD res = foo<VectorAD>(ap);
+ VERIFY_IS_APPROX(res.value(), foo(p));
}
void test_autodiff_jacobian()
{
- for(int i = 0; i < g_repeat; i++) {
- CALL_SUBTEST(( forward_jacobian(TestFunc1<double,2,2>()) ));
- CALL_SUBTEST(( forward_jacobian(TestFunc1<double,2,3>()) ));
- CALL_SUBTEST(( forward_jacobian(TestFunc1<double,3,2>()) ));
- CALL_SUBTEST(( forward_jacobian(TestFunc1<double,3,3>()) ));
- CALL_SUBTEST(( forward_jacobian(TestFunc1<double>(3,3)) ));
- }
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,2,2>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,2,3>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,3,2>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double,3,3>()) ));
+ CALL_SUBTEST(( forward_jacobian(TestFunc1<double>(3,3)) ));
}
void test_autodiff()
{
- test_autodiff_scalar();
- test_autodiff_vector();
-// test_autodiff_jacobian();
+ for(int i = 0; i < g_repeat; i++) {
+ CALL_SUBTEST_1( test_autodiff_scalar() );
+ CALL_SUBTEST_2( test_autodiff_vector() );
+ CALL_SUBTEST_3( test_autodiff_jacobian() );
+ }
}