mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add a unit test for permutation applied to sparse objects
This commit is contained in:
@@ -24,23 +24,6 @@
|
||||
|
||||
#include "main.h"
|
||||
|
||||
template<typename PermutationVectorType>
|
||||
void randomPermutationVector(PermutationVectorType& v, typename PermutationVectorType::Index size)
|
||||
{
|
||||
typedef typename PermutationVectorType::Index Index;
|
||||
typedef typename PermutationVectorType::Scalar Scalar;
|
||||
v.resize(size);
|
||||
for(Index i = 0; i < size; ++i) v(i) = Scalar(i);
|
||||
if(size == 1) return;
|
||||
for(Index n = 0; n < 3 * size; ++n)
|
||||
{
|
||||
Index i = internal::random<Index>(0, size-1);
|
||||
Index j;
|
||||
do j = internal::random<Index>(0, size-1); while(j==i);
|
||||
std::swap(v(i), v(j));
|
||||
}
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
template<typename MatrixType> void permutationmatrices(const MatrixType& m)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user