00001 /************************************************************************* 00002 * 00003 * The Contents of this file are made available subject to 00004 * the terms of GNU Lesser General Public License Version 2.1. 00005 * 00006 * 00007 * GNU Lesser General Public License Version 2.1 00008 * ============================================= 00009 * Copyright 2005-2008 by Kohei Yoshida. 00010 * 1039 Kingsway Dr., Apex, NC 27502, USA 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License version 2.1, as published by the Free Software Foundation. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00024 * MA 02111-1307 USA 00025 * 00026 ************************************************************************/ 00027 00028 #ifndef _SCSOLVER_NUMERIC_POLYEQNSOLVER_HXX_ 00029 #define _SCSOLVER_NUMERIC_POLYEQNSOLVER_HXX 00030 00031 #include <list> 00032 #include <exception> 00033 00034 namespace scsolver { namespace numeric { 00035 00036 class Matrix; 00037 00038 class NotEnoughDataPoints : public ::std::exception 00039 { 00040 public: 00041 virtual const char* what() const throw(); 00042 }; 00043 00044 struct DataPoint 00045 { 00046 double X; 00047 double Y; 00048 00049 DataPoint(double x, double y); 00050 }; 00051 00060 class PolyEqnSolver 00061 { 00062 public: 00063 PolyEqnSolver(); 00064 ~PolyEqnSolver() throw(); 00065 00066 void addDataPoint(double x, double y); 00067 const Matrix solve(); 00068 void clear(); 00069 00075 size_t size() const; 00076 00077 private: 00078 ::std::list<DataPoint> m_DataPoints; 00079 }; 00080 00081 // ---------------------------------------------------------------------------- 00082 00094 void getQuadraticPeak(double& x, double& y, const Matrix& coef); 00095 00096 }} 00097 00098 #endif
1.5.3