<commit_before>/* +---------------------------------------------------------------------------+
   |                     Mobile Robot Programming Toolkit (MRPT)               |
   |                          http://www.mrpt.org/                             |
   |                                                                           |
   | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file        |
   | See: http://www.mrpt.org/Authors - All rights reserved.                   |
   | Released under BSD License. See details in http://www.mrpt.org/License    |
   +---------------------------------------------------------------------------+ */


#include <mrpt/graphs/ScalarFactorGraph.h>
#include <gtest/gtest.h>

using namespace mrpt;
using namespace mrpt::graphs;
using namespace std;

#if EIGEN_VERSION_AT_LEAST(3,1,0) // Requires Eigen>=3.1

struct MySimpleUnaryEdge : public ScalarFactorGraph::UnaryFactorVirtualBase
{
	MySimpleUnaryEdge(vector<double> &parent, size_t nodeid, double observation, double information) :
		m_parent(parent),
		m_observation(observation),
		m_information(information)
	{
		this->node_id = nodeid;
	}

	double evaluateResidual() const override
	{
		return m_parent[node_id] - m_observation;
	}
	double getInformation() const override
	{
		return m_information;
	}
	void evalJacobian(double &dr_dx) const override
	{
		dr_dx = 1.0;
	}

protected:
	vector<double> &m_parent;
	double m_observation, m_information;
};

struct MySimpleBinaryEdge : public ScalarFactorGraph::BinaryFactorVirtualBase
{
	MySimpleBinaryEdge(vector<double> &parent, size_t nodeid_i, size_t nodeid_j, double information) :
		m_parent(parent),
		m_information(information)
	{
		this->node_id_i = nodeid_i;
		this->node_id_j = nodeid_j;
	}

	double evaluateResidual() const override
	{
		return m_parent[node_id_i] - m_parent[node_id_j];
	}
	double getInformation() const override
	{
		return m_information;
	}
	void evalJacobian(double &dr_dx_i, double &dr_dx_j ) const override
	{
		dr_dx_i = +1.0;
		dr_dx_j = -1.0;
	}
<commit_msg>C++11 override -> MRPT_OVERRIDE; FTBFS in Ubuntu precise<commit_after>/* +---------------------------------------------------------------------------+
   |                     Mobile Robot Programming Toolkit (MRPT)               |
   |                          http://www.mrpt.org/                             |
   |                                                                           |
   | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file        |
   | See: http://www.mrpt.org/Authors - All rights reserved.                   |
   | Released under BSD License. See details in http://www.mrpt.org/License    |
   +---------------------------------------------------------------------------+ */


#include <mrpt/graphs/ScalarFactorGraph.h>
#include <gtest/gtest.h>

using namespace mrpt;
using namespace mrpt::graphs;
using namespace std;

#if EIGEN_VERSION_AT_LEAST(3,1,0) // Requires Eigen>=3.1

struct MySimpleUnaryEdge : public ScalarFactorGraph::UnaryFactorVirtualBase
{
	MySimpleUnaryEdge(vector<double> &parent, size_t nodeid, double observation, double information) :
		m_parent(parent),
		m_observation(observation),
		m_information(information)
	{
		this->node_id = nodeid;
	}

	double evaluateResidual() const MRPT_OVERRIDE
	{
		return m_parent[node_id] - m_observation;
	}
	double getInformation() const MRPT_OVERRIDE
	{
		return m_information;
	}
	void evalJacobian(double &dr_dx) const MRPT_OVERRIDE
	{
		dr_dx = 1.0;
	}

protected:
	vector<double> &m_parent;
	double m_observation, m_information;
};

struct MySimpleBinaryEdge : public ScalarFactorGraph::BinaryFactorVirtualBase
{
	MySimpleBinaryEdge(vector<double> &parent, size_t nodeid_i, size_t nodeid_j, double information) :
		m_parent(parent),
		m_information(information)
	{
		this->node_id_i = nodeid_i;
		this->node_id_j = nodeid_j;
	}

	double evaluateResidual() const MRPT_OVERRIDE
	{
		return m_parent[node_id_i] - m_parent[node_id_j];
	}
	double getInformation() const MRPT_OVERRIDE
	{
		return m_information;
	}
	void evalJacobian(double &dr_dx_i, double &dr_dx_j ) const MRPT_OVERRIDE
	{
		dr_dx_i = +1.0;
		dr_dx_j = -1.0;
	}

{'fraction_non_alphanumeric': 0.16471990464839095, 'fraction_numerical': 0.009535160905840286, 'mean_word_length': 2.245166279969064, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6951958', 'n_tokens_mistral': 1397, 'n_tokens_neox': 1309, 'n_words': 266}