Skip to content
Snippets Groups Projects
  • Angel Santamaria-Navarro's avatar
    7b01a780
    Fix odd bug about rotations... · 7b01a780
    Angel Santamaria-Navarro authored
    Bug was: in Eigen matrix functions, passing a matrix expression by reference means
    that each time the reference is needed the expression was reevaluated.
    This produced that when calling a function
      e.g. f( Matrix::Random() ),
    the parameter passed is an expression and not a matrix. Therefore, each
    time the matrix is used in f(), a new Random was created.
    
    Solution: use the .eval() method to evaluate the expression:
    as in
      e.g. f( Matrix::Random().eval() )
    7b01a780
    History
    Fix odd bug about rotations...
    Angel Santamaria-Navarro authored
    Bug was: in Eigen matrix functions, passing a matrix expression by reference means
    that each time the reference is needed the expression was reevaluated.
    This produced that when calling a function
      e.g. f( Matrix::Random() ),
    the parameter passed is an expression and not a matrix. Therefore, each
    time the matrix is used in f(), a new Random was created.
    
    Solution: use the .eval() method to evaluate the expression:
    as in
      e.g. f( Matrix::Random().eval() )