mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-30 17:40:05 +08:00
Still fixing warnings.
This commit is contained in:
parent
cb11f2f8a6
commit
546b802b77
@ -385,8 +385,9 @@ bool test_is_equal(const T& actual, const U& expected)
|
|||||||
* This is very useful to test rank-revealing algorithms.
|
* This is very useful to test rank-revealing algorithms.
|
||||||
*/
|
*/
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
void createRandomPIMatrixOfRank(typename MatrixType::Index desired_rank, typename MatrixType::Index rows, int cols, MatrixType& m)
|
void createRandomPIMatrixOfRank(typename MatrixType::Index desired_rank, typename MatrixType::Index rows, typename MatrixType::Index cols, MatrixType& m)
|
||||||
{
|
{
|
||||||
|
typedef typename ei_traits<MatrixType>::Index Index;
|
||||||
typedef typename ei_traits<MatrixType>::Scalar Scalar;
|
typedef typename ei_traits<MatrixType>::Scalar Scalar;
|
||||||
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
|
enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };
|
||||||
|
|
||||||
@ -412,7 +413,7 @@ void createRandomPIMatrixOfRank(typename MatrixType::Index desired_rank, typenam
|
|||||||
MatrixBType b = MatrixBType::Random(cols,cols);
|
MatrixBType b = MatrixBType::Random(cols,cols);
|
||||||
|
|
||||||
// set the diagonal such that only desired_rank non-zero entries reamain
|
// set the diagonal such that only desired_rank non-zero entries reamain
|
||||||
const int diag_size = std::min(d.rows(),d.cols());
|
const Index diag_size = std::min(d.rows(),d.cols());
|
||||||
if(diag_size != desired_rank)
|
if(diag_size != desired_rank)
|
||||||
d.diagonal().segment(desired_rank, diag_size-desired_rank) = VectorType::Zero(diag_size-desired_rank);
|
d.diagonal().segment(desired_rank, diag_size-desired_rank) = VectorType::Zero(diag_size-desired_rank);
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ template<typename MatrixType> void product(const MatrixType& m)
|
|||||||
|
|
||||||
Scalar s1 = ei_random<Scalar>();
|
Scalar s1 = ei_random<Scalar>();
|
||||||
|
|
||||||
int r = ei_random<int>(0, rows-1),
|
Index r = ei_random<Index>(0, rows-1),
|
||||||
c = ei_random<int>(0, cols-1),
|
c = ei_random<Index>(0, cols-1),
|
||||||
c2 = ei_random<int>(0, cols-1);
|
c2 = ei_random<Index>(0, cols-1);
|
||||||
|
|
||||||
// begin testing Product.h: only associativity for now
|
// begin testing Product.h: only associativity for now
|
||||||
// (we use Transpose.h but this doesn't count as a test for it)
|
// (we use Transpose.h but this doesn't count as a test for it)
|
||||||
|
@ -60,10 +60,10 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m)
|
|||||||
s2 = ei_random<Scalar>(),
|
s2 = ei_random<Scalar>(),
|
||||||
s3 = ei_random<Scalar>();
|
s3 = ei_random<Scalar>();
|
||||||
|
|
||||||
int c0 = ei_random<int>(4,cols-8),
|
Index c0 = ei_random<Index>(4,cols-8),
|
||||||
c1 = ei_random<int>(8,cols-c0),
|
c1 = ei_random<Index>(8,cols-c0),
|
||||||
r0 = ei_random<int>(4,cols-8),
|
r0 = ei_random<Index>(4,cols-8),
|
||||||
r1 = ei_random<int>(8,rows-r0);
|
r1 = ei_random<Index>(8,rows-r0);
|
||||||
|
|
||||||
VERIFY_EVALUATION_COUNT( m3 = (m1 * m2.adjoint()), 1);
|
VERIFY_EVALUATION_COUNT( m3 = (m1 * m2.adjoint()), 1);
|
||||||
VERIFY_EVALUATION_COUNT( m3.noalias() = m1 * m2.adjoint(), 0);
|
VERIFY_EVALUATION_COUNT( m3.noalias() = m1 * m2.adjoint(), 0);
|
||||||
|
@ -30,8 +30,8 @@ template<typename MatrixType> void qr()
|
|||||||
{
|
{
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
|
|
||||||
Index rows = ei_random<int>(20,200), cols = ei_random<int>(20,200), cols2 = ei_random<int>(20,200);
|
Index rows = ei_random<Index>(20,200), cols = ei_random<int>(20,200), cols2 = ei_random<int>(20,200);
|
||||||
Index rank = ei_random<int>(1, std::min(rows, cols)-1);
|
Index rank = ei_random<Index>(1, std::min(rows, cols)-1);
|
||||||
|
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
|
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;
|
||||||
|
@ -68,9 +68,10 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m)
|
|||||||
|
|
||||||
template<typename VectorType> void vectorRedux(const VectorType& w)
|
template<typename VectorType> void vectorRedux(const VectorType& w)
|
||||||
{
|
{
|
||||||
|
typedef typename VectorType::Index Index;
|
||||||
typedef typename VectorType::Scalar Scalar;
|
typedef typename VectorType::Scalar Scalar;
|
||||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||||
int size = w.size();
|
Index size = w.size();
|
||||||
|
|
||||||
VectorType v = VectorType::Random(size);
|
VectorType v = VectorType::Random(size);
|
||||||
for(int i = 1; i < size; i++)
|
for(int i = 1; i < size; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user