Added print function to Permuted<>

release/4.3a0
Richard Roberts 2012-01-06 16:52:06 +00:00
parent 610faa8439
commit bd35c8b7da
1 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <vector>
#include <string>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <gtsam/base/types.h>
@ -168,6 +169,13 @@ public:
*/
Permuted(CONTAINER& container) : permutation_(Permutation::Identity(container.size())), container_(container) {}
/** Print */
void print(const std::string& str = "") const {
std::cout << str;
permutation_.print(" permutation: ");
container_.print(" container: ");
}
/** Access the container through the permutation */
value_type& operator[](size_t index) { return container_[permutation_[index]]; }