gtsam/cpp/DeltaFunction.cpp

61 lines
1.1 KiB
C++

/*
* DeltaFunction.cpp
*
* Created on: Aug 11, 2009
* Author: alexgc
*/
#include <iostream>
#include "DeltaFunction.h"
namespace gtsam {
using namespace std;
DeltaFunction::DeltaFunction() {
// TODO Auto-generated constructor stub
}
DeltaFunction::DeltaFunction(const Vector& v, const std::string& id)
: value(v), key(id)
{
}
DeltaFunction::DeltaFunction(const DeltaFunction& df)
: boost::noncopyable(), value(df.value), key(df.key)
{
}
DeltaFunction::~DeltaFunction() {
// TODO Auto-generated destructor stub
}
bool DeltaFunction::equals(const DeltaFunction &df) const
{
return equal_with_abs_tol(value, df.value) && key == df.key;
}
void DeltaFunction::print() const
{
cout << "DeltaFunction: [" << key << "]";
gtsam::print(value);
cout << endl;
}
bool assert_equal(const DeltaFunction& actual, const DeltaFunction& expected, double tol)
{
bool ret = actual.equals(expected);
if (!ret)
{
cout << "Not Equal!" << endl;
cout << " Actual:" << endl;
actual.print();
cout << " Expected:" << endl;
expected.print();
}
return ret;
}
}