mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
* Add fixed-size template versions of corner(), start(), end().
* Use them to write an unrolled path in echelon.cpp, as an experiment before I do this LU module. * For floating-point types, make ei_random() use an amplitude of 1.
This commit is contained in:
@@ -28,6 +28,11 @@
|
||||
template<typename T> inline typename NumTraits<T>::Real precision();
|
||||
template<typename T> inline T ei_random(T a, T b);
|
||||
template<typename T> inline T ei_random();
|
||||
template<typename T> inline T ei_random_amplitude()
|
||||
{
|
||||
if(NumTraits<T>::HasFloatingPoint) return static_cast<T>(1);
|
||||
else return static_cast<T>(10);
|
||||
}
|
||||
|
||||
template<> inline int precision<int>() { return 0; }
|
||||
inline int ei_real(int x) { return x; }
|
||||
@@ -54,7 +59,7 @@ template<> inline int ei_random(int a, int b)
|
||||
}
|
||||
template<> inline int ei_random()
|
||||
{
|
||||
return ei_random<int>(-10, 10);
|
||||
return ei_random<int>(-ei_random_amplitude<int>(), ei_random_amplitude<int>());
|
||||
}
|
||||
inline bool ei_isMuchSmallerThan(int a, int, int = precision<int>())
|
||||
{
|
||||
@@ -88,7 +93,7 @@ template<> inline float ei_random(float a, float b)
|
||||
}
|
||||
template<> inline float ei_random()
|
||||
{
|
||||
return ei_random<float>(-10.0f, 10.0f);
|
||||
return ei_random<float>(-ei_random_amplitude<float>(), ei_random_amplitude<float>());
|
||||
}
|
||||
inline bool ei_isMuchSmallerThan(float a, float b, float prec = precision<float>())
|
||||
{
|
||||
@@ -122,7 +127,7 @@ template<> inline double ei_random(double a, double b)
|
||||
}
|
||||
template<> inline double ei_random()
|
||||
{
|
||||
return ei_random<double>(-10.0, 10.0);
|
||||
return ei_random<double>(-ei_random_amplitude<double>(), ei_random_amplitude<double>());
|
||||
}
|
||||
inline bool ei_isMuchSmallerThan(double a, double b, double prec = precision<double>())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user