fitting-tool.h revision 8001ba81cb851b38d86650a2fef5817facffb763
/*
* Fitting Tools
*
* Authors:
* Marco Cecchetti <mrcekets at gmail.com>
*
* Copyright 2008 authors
*
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*/
#ifndef _NL_FITTING_TOOL_H_
#define _NL_FITTING_TOOL_H_
#include <vector>
{
typedef ModelT model_type;
m_total_samples(0),
{
}
// compute pseudo inverse
void update()
{
if (total_samples() == 0) return;
if (m_psdinv_matrix != NULL)
{
}
}
size_t total_samples() const
{
return m_total_samples;
}
bool is_full() const
{
}
void clear()
{
m_total_samples = 0;
}
~lsf_base()
{
if (m_psdinv_matrix != NULL)
{
}
}
const model_type & m_model;
}; // end class lsf_base
{
};
// a fitting process on samples with value of type double
// produces a solution of type Vector
{
typedef ModelT model_type;
typedef Vector solution_type;
{
}
{
return m_solution;
}
// a comparison between old sample values and the new ones is performed
// in order to minimize computation
// prerequisite:
// old_sample_values.size() == new_sample_values.size()
// no update() call can be performed between two result invocations
VectorT const& new_sample_values )
{
{
}
{
if (diff[i] != 0)
{
}
}
m_solution += delta;
return m_solution;
}
{
return m_solution;
}
}; // end class lsf_solution<ModelT, double>
// a fitting process on samples with value of type Point
// produces a solution of type Matrix (with 2 columns)
{
typedef ModelT model_type;
typedef Matrix solution_type;
{
}
{
for (size_t i = 0; i < total_samples(); ++i)
{
svm(i, X) = sample_values[i][X];
svm(i, Y) = sample_values[i][Y];
}
return m_solution;
}
// a comparison between old sample values and the new ones is performed
// in order to minimize computation
// prerequisite:
// old_sample_values.size() == new_sample_values.size()
// no update() call can to be performed between two result invocations
{
for (size_t i = 0; i < total_samples(); ++i)
{
}
for (size_t i = 0; i < total_samples(); ++i)
{
if (diff(i, X) != 0)
{
}
if (diff(i, Y) != 0)
{
}
}
m_solution += delta;
return m_solution;
}
{
return m_solution;
}
}; // end class lsf_solution<ModelT, Point>
{
};
// fitting tool for completely unknown models
{
typedef ModelT model_type;
{
}
{
}
{
}
}; // end class lsf_with_fixed_terms<ModelT, false>
// fitting tool for partially known models
{
typedef ModelT model_type;
{
}
{
}
{
}
void update()
{
if (total_samples() == 0) return;
if (m_vector_view != NULL)
{
}
}
~lsf_with_fixed_terms<model_type, true>()
{
if (m_vector_view != NULL)
{
}
}
}; // end class lsf_with_fixed_terms<ModelT, true>
} // end namespace detail
{
};
{
typedef ModelT model_type;
{
}
}; // end class least_squeares_fitter<ModelT, ValueType, true>
{
typedef ModelT model_type;
{
}
{
}
}; // end class least_squeares_fitter<ModelT, double, true>
{
typedef ModelT model_type;
{
}
{
{
}
}
}; // end class least_squeares_fitter<ModelT, Point, true>
} // end namespace NL
} // end namespace Geom
#endif // _NL_FITTING_TOOL_H_
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :