Drake
drake::test Namespace Reference

Classes

class  AutoDiffXdTest
 

Functions

template<typename T , typename InvariantPred = std::equal_to<T>>
bool IsMemcpyMovable (const T &value, const InvariantPred &invariant_pred=InvariantPred())
 Checks if value of T type is movable via memcpy. More...
 
template<typename CoefficientType = double>
static Eigen::Matrix< Polynomial< CoefficientType >, Eigen::Dynamic, Eigen::Dynamic > RandomPolynomialMatrix (Eigen::Index num_coefficients_per_polynomial, Eigen::Index rows, Eigen::Index cols)
 Obtains a matrix of random unvariate Polynomials of the specified size. More...
 
template<typename CoefficientType = double>
PiecewisePolynomial< CoefficientType > MakeRandomPiecewisePolynomial (Eigen::Index rows, Eigen::Index cols, Eigen::Index num_coefficients_per_polynomial, const std::vector< double > &segment_times)
 Obtains a random PiecewisePolynomial with the given segment_times. More...
 

Function Documentation

bool drake::test::IsMemcpyMovable ( const T &  value,
const InvariantPred &  invariant_pred = InvariantPred() 
)

Checks if value of T type is movable via memcpy.

That is, it tests memcpy on value keeps a given invariant between value and a copy of it. It uses a binary function object invariant_pred to check for invariance.

Note
Eigen's reallocation mechanisms have an issue. It is moving bytes using memcpy without calling a move constructor. As a result, if a Scalar type of Eigen matrix/array is not IsMemcpyMovable, we have undefined behavior when conservativeResize method is called. This should always be used to test a Scalar used within an Eigen::EigenBase<...> object. Please see https://github.com/RobotLocomotion/drake/issues/5974 for more information.
PiecewisePolynomial<CoefficientType> drake::test::MakeRandomPiecewisePolynomial ( Eigen::Index  rows,
Eigen::Index  cols,
Eigen::Index  num_coefficients_per_polynomial,
const std::vector< double > &  segment_times 
)

Obtains a random PiecewisePolynomial with the given segment_times.

Each segment will have a matrix of random Polynomials of the specified size.

static Eigen::Matrix<Polynomial<CoefficientType>, Eigen::Dynamic, Eigen::Dynamic> drake::test::RandomPolynomialMatrix ( Eigen::Index  num_coefficients_per_polynomial,
Eigen::Index  rows,
Eigen::Index  cols 
)
static

Obtains a matrix of random unvariate Polynomials of the specified size.

Here is the call graph for this function: