Commit 56c3d48b by Nils Rummler

### Vollstaendige implementierung für float und double eingabeparameter. erweiterung der Testfunktion

parent a23987ec
 ... ... @@ -37,12 +37,14 @@ namespace ITABase * Coefficients [a0, b0, c0, d0, a1, b1, c1, d1] belong to interval 0 [x0, x1] and interval 1 [x1, x2] respectively. * The coefficients for interval 1 represent the following polynomial of order 3: * f(x) = a1(x−x1)^3 + b1(x−x1)^2 + c1(x−x1) + d1 * * All data is internally computed as values of type double. Nevertheless there are overloaded functions for input of type float. These are converted internally. */ class ITA_BASE_API CPiecewisePolynomial { public: CPiecewisePolynomial(const std::vector& vdBreakPoints, const std::vector& vdCoeffs, const int iOrder); CPiecewisePolynomial(const std::vector& vdBreakPnts, const std::vector& vdCoeffs, const int iOrder); //! Returns the polynomial order inline int Order() const { return iOrder; }; //! Returns the number of intervals (pieces) between break points ... ...
 ... ... @@ -41,10 +41,12 @@ namespace ITABase //! Uses cubic splines to interpolate the function defined by the given data pairs vdSupportingPoints and vdDataPoints to a vector of points ITA_BASE_API std::vector CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, const std::vector& vdEvalPoints); //! Uses cubic splines to interpolate the function defined by the given data pairs vdSupportingPoints and vdDataPoints to a vector of points ITA_BASE_API std::vector CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, const std::vector& vdEvalPoints); ITA_BASE_API std::vector CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, const std::vector& vdEvalPoints); //! Uses cubic splines to interpolate the function defined by the given data pairs vdSupportingPoints and vdDataPoints to a single point // ITA_BASE_API float CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, double dEvalPoint); ITA_BASE_API double CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, double dEvalPoint); //! Uses cubic splines to interpolate the function defined by the given data pairs vdSupportingPoints and vdDataPoints to a single point. BEWARE of the internal conversion to type double! ITA_BASE_API float CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, float dEvalPoint); } } ... ...
 ... ... @@ -25,6 +25,30 @@ CPiecewisePolynomial::CPiecewisePolynomial(const std::vector& vdBreakPoi if (vdCoeffs.size() != nCoeffs) ITA_EXCEPT_INVALID_PARAMETER("Invalid number of coefficients: Expected " + std::to_string(nCoeffs) + " but got " + std::to_string(vdCoeffs.size()) + "."); } CPiecewisePolynomial::CPiecewisePolynomial(const std::vector& vdBreakPnts, const std::vector& vdCoeffs, const int iOrder) : iOrder(iOrder) { /* auto doubles_BreakPoints = std::vector(vdBreakPnts.begin(), vdBreakPnts.end()); auto double_vdCoeffs = std::vector(vdCoeffs.begin(), vdCoeffs.end()); CPiecewisePolynomial(doubles_BreakPoints, double_vdCoeffs, iOrder); */ auto doubles_BreakPoints = std::vector(vdBreakPnts.begin(), vdBreakPnts.end()); auto double_vdCoeffs = std::vector(vdCoeffs.begin(), vdCoeffs.end()); vdCoefficients = double_vdCoeffs; vdBreakPoints = doubles_BreakPoints; if (iOrder < 0) ITA_EXCEPT_INVALID_PARAMETER("Polynom order must be greater or equal zero."); const int iMinimumNBreakPoints = 2; // At least one interval if (vdBreakPnts.size() < iMinimumNBreakPoints) ITA_EXCEPT_INVALID_PARAMETER("Number of break points not sufficient for polynom order: Expected " + std::to_string(iMinimumNBreakPoints) + " but got " + std::to_string(vdBreakPoints.size()) + "."); const int nCoeffs = NumIntervals() * (iOrder + 1); if (vdCoeffs.size() != nCoeffs) ITA_EXCEPT_INVALID_PARAMETER("Invalid number of coefficients: Expected " + std::to_string(nCoeffs) + " but got " + std::to_string(vdCoeffs.size()) + "."); } double CPiecewisePolynomial::Value(const double & xValue, bool bExtrapolate) const { ... ... @@ -51,7 +75,7 @@ double CPiecewisePolynomial::Value(const double & xValue, bool bExtrapolate) con } double CPiecewisePolynomial::Value(const float& xValue, bool bExtrapolate) const { return Value(float(xValue), bExtrapolate); return Value(double(xValue), bExtrapolate); } std::vector CPiecewisePolynomial::Value(const std::vector& vdXValues, bool bExtrapolate) const { ... ...
 ... ... @@ -7,27 +7,6 @@ using namespace ITABase; using namespace ITABase::Math; //basic Constructors CPiecewisePolynomial CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints) { //Typecasting upwards to doubles auto doubles_SupportingPoints = std::vector(vdSupportingPoints.begin(), vdSupportingPoints.end()); auto doubles_DataPoints = std::vector(vdDataPoints.begin(), vdDataPoints.end()); return CubicSpline(doubles_SupportingPoints, doubles_DataPoints);//Constructor working with doubles } CPiecewisePolynomial CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints) { //Typecasting upwards to doubles auto doubles_SupportingPoints = std::vector(vdSupportingPoints.begin(), vdSupportingPoints.end()); return CubicSpline(doubles_SupportingPoints, vdDataPoints);//Constructor working with doubles } CPiecewisePolynomial CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints) { //Typecasting upwards to doubles auto doubles_DataPoints = std::vector(vdDataPoints.begin(), vdDataPoints.end()); return CubicSpline(vdSupportingPoints, doubles_DataPoints);//Constructor working with doubles } CPiecewisePolynomial ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints) { /*setUp the bandmatrix M with the the h values. The vector with the coefficent b is called b. ... ... @@ -102,25 +81,49 @@ CPiecewisePolynomial ITABase::Math::CubicSpline(const std::vector& vdSup return CPiecewisePolynomial(vdSupportingPoints, vdCoefficients, iPolynomialOrder); } //Constructors with vectors std::vector CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, const std::vector& vdEvalPoints) CPiecewisePolynomial ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints) { //Typecasting upwards to doubles auto doubles_SupportingPoints = std::vector(vdSupportingPoints.begin(), vdSupportingPoints.end()); auto doubles_DataPoints = std::vector(vdDataPoints.begin(), vdDataPoints.end()); return CubicSpline(doubles_SupportingPoints, doubles_DataPoints);//Constructor working with doubles } CPiecewisePolynomial ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints) { //Typecasting upwards to doubles auto doubles_SupportingPoints = std::vector(vdSupportingPoints.begin(), vdSupportingPoints.end()); return CubicSpline(doubles_SupportingPoints, vdDataPoints);//Constructor working with doubles } CPiecewisePolynomial ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints) { //Typecasting upwards to doubles auto doubles_DataPoints = std::vector(vdDataPoints.begin(), vdDataPoints.end()); return CubicSpline(vdSupportingPoints, doubles_DataPoints);//Constructor working with doubles } //Constructors returning evaluated Points std::vector ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, const std::vector& vdEvalPoints) { CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); return myPoly.Value(vdEvalPoints); } /* std::vector CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, const std::vector& vdEvalPoints) std::vector ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, const std::vector& vdEvalPoints) { CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); return myPoly.Value(vdEvalPoints); } //Constructor for impatient users ;) float Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, double dEvalPoint) double ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, double dEvalPoint) { CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); return myPoly.Value(dEvalPoint); } */ \ No newline at end of file float ITABase::Math::CubicSpline(const std::vector& vdSupportingPoints, const std::vector& vdDataPoints, float dEvalPoint) { CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); return float(myPoly.Value(dEvalPoint)); }
 ... ... @@ -28,8 +28,10 @@ using namespace ITABase::Math; bool SpeedTest() { /* //the following data is random. std::cout << std::endl << "zuerst wird der benchmark mit DOUBLES ausgefuert:" << std::endl; std::vector vdSupportingPoints{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector vdDataPoints2{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; std::vector vdX = { -10, 1.5, -7.898,3.3, 3.3,9.9,-2.5,8.9,0.01,-4.3 }; ... ... @@ -53,88 +55,87 @@ bool SpeedTest() { myWatch.stop(); } std::cout << myWatch << std::endl; */ myWatch.reset(); //JETZT MIT FLOAT std::cout << std::endl << "Nun wird das gleiche noch mit FLOATS wiederholt:" << std:: endl; std::vector vdSupportingPoints_float{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector vdDataPoints2_float{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; std::vector vdX_float = { float(-10), float(1.5), float(-7.898),float(3.3), float(3.3),float(9.9),float(-2.5),float(8.9),float(0.01),float(-4.3) }; CPiecewisePolynomial myPoly_float = CubicSpline(vdSupportingPoints_float, vdDataPoints2_float); std::vector result_float(10); std::cout << "Rueckgabe von piecwisePolynomial Objekten" << std::endl; for (int k = 0; k < 100; k++) { myWatch.start(); myPoly_float = CubicSpline(vdSupportingPoints_float, vdDataPoints2_float); myWatch.stop(); } std::cout << myWatch << std::endl; myWatch.reset(); std::cout << "Rueckgabe von vector Objekten" << std::endl; for (int k = 0; k < 100; k++) { myWatch.start(); result = CubicSpline(vdSupportingPoints_float, vdDataPoints2_float, vdX_float); myWatch.stop(); } std::cout << myWatch << std::endl; return true; } //!creates one .txt file with the Points a spline function shall be constructed for and one with the cooeficients, this programm has computes. A third contains the coefficenc of the derivate. All can be read by the SplineTest.m into MATLAB. void Compare2MATLAB(){ /* //ALLES mit FLOATS //the following data is random. std::vector vdSupportingPoints{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector vdDataPoints{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; std::vector vdX = {-10, 1.5, -7.898,3.3, 3.3,9.9,-2.5,8.9,0.01,-4.3 }; CPiecewisePolynomial myPoly =CubicSpline(vdSupportingPoints, vdDataPoints); CPiecewisePolynomial myDerivate = myPoly.Derivation(); std::vector vdCoeff = myPoly.Coefficients(); std::ofstream myFile; myFile.open("points.txt"); for (int k = 0; k < vdDataPoints.size(); k++) { myFile << vdSupportingPoints[k] << ", " << vdDataPoints[k] << std::endl; } myFile.close(); //the following data is random. std::vector vdSupportingPoints{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector vdDataPoints{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; std::vector vdX = { -10, 1.5, -7.898,3.3, 3.3,9.9,-2.5,8.9,0.01,-4.3 }; CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); CPiecewisePolynomial myDerivate = myPoly.Derivation(); myFile.open("coeff.txt"); for (int k = 0; k < vdDataPoints.size() - 1; k++) { myFile << vdCoeff[4 * k] << ", " << vdCoeff[4 * k + 1] << ", " << vdCoeff[4 * k + 2] << ", " << vdCoeff[4 * k + 3] << std::endl; } myFile.close(); std::vector vdCoeff = myPoly.Coefficients(); std::ofstream myFile; myFile.open("points.txt"); for (int k = 0; k < vdDataPoints.size(); k++) { myFile << vdSupportingPoints[k] << ", " << vdDataPoints[k] << std::endl; } myFile.close(); vdCoeff = myDerivate.Coefficients(); myFile.open("derivate.txt"); for (int k = 0; k < vdDataPoints.size() - 1; k++) { myFile << vdCoeff[3 * k] << ", " << vdCoeff[3 * k + 1] << ", " << vdCoeff[3 * k + 2] << std::endl; } myFile.close(); return; //the following data is random. std::vector vdSupportingPoints{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector vdDataPoints{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; std::vector vdX = { -10, 1.5, -7.898,3.3, 3.3,9.9,-2.5,8.9,0.01,-4.3 }; CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); CPiecewisePolynomial myDerivate = myPoly.Derivation(); myFile.open("coeff.txt"); for (int k = 0; k < vdDataPoints.size() - 1; k++) { myFile << vdCoeff[4 * k] << ", " << vdCoeff[4 * k + 1] << ", " << vdCoeff[4 * k + 2] << ", " << vdCoeff[4 * k + 3] << std::endl; } myFile.close(); std::vector vdCoeff = myPoly.Coefficients(); std::ofstream myFile; myFile.open("points.txt"); for (int k = 0; k < vdDataPoints.size(); k++) { myFile << vdSupportingPoints[k] << ", " << vdDataPoints[k] << std::endl; } myFile.close(); vdCoeff = myDerivate.Coefficients(); myFile.open("derivate.txt"); for (int k = 0; k < vdDataPoints.size() - 1; k++) { myFile << vdCoeff[3 * k] << ", " << vdCoeff[3 * k + 1] << ", " << vdCoeff[3 * k + 2] << std::endl; } myFile.close(); myFile.open("coeff.txt"); for (int k = 0; k < vdDataPoints.size() - 1; k++) { myFile << vdCoeff[4 * k] << ", " << vdCoeff[4 * k + 1] << ", " << vdCoeff[4 * k + 2] << ", " << vdCoeff[4 * k + 3] << std::endl; } myFile.close(); vdCoeff = myDerivate.Coefficients(); myFile.open("derivate.txt"); for (int k = 0; k < vdDataPoints.size() - 1; k++) { myFile << vdCoeff[3 * k] << ", " << vdCoeff[3 * k + 1] << ", " << vdCoeff[3 * k + 2] << std::endl; } myFile.close(); */ return; } //!Checks the general behavior of the code bool GeneralTest(){ /*//ALLES mit FLOATS //ALLES mit FLOATS //the following data is random. const std::vector vdSupportingPoints{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; const std::vector vdDataPoints{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; const std::vector vdX = {-10, 1.5f, -7.898f,3.3f, 3.3f,9.9f,-2.5f,8.9f,0.01f,-4.3f }; CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); std::cout << "-------Starting with FLOAT values-------" << std::endl << std::endl; std::cout << "At supportion Point 0, the calculated value should be 66: " << myPoly.Value(0) << std::endl; std::cout << "At supportion Point 0, the calculated value should be 66: " << myPoly.Value(float(0)) << std::endl; //should get specific Value std::cout << "At random Point x=0.5 the spline should interpolate ~40.9: " << myPoly.Value(0.5) << std::endl; std::cout << "At random Point x=0.5 the spline should interpolate ~40.9: " << myPoly.Value(float(0.5)) << std::endl; /* std::vector vdBreakPoints = { 0, 1 }; std::vector vdCoeff = { 1,1,1 }; int iOrder = 2; ... ... @@ -147,13 +148,13 @@ bool GeneralTest(){ //exceptions for Piecewise Polynoms std::cout << "Testing the Value function with Argument out of it's range, without extrapolation:" << std::endl; try { myPoly2.Value(-2); } try { myPoly2.Value(float(-2)); } catch (ITAException& err) { std::cout << err << std::endl; } std::cout << "Testing the Value function with Arguments out of it's range, with extrapolation:" << std::endl; std::cout << "At -2, the calculated value should be -1: " << myPoly2.Value(-2,true) << std::endl; std::cout << "At 2, the calculated value should be 6: " << myPoly2.Value(2, true) << std::endl; std::cout << "At -2, the calculated value should be -1: " << myPoly2.Value(float(-2),true) << std::endl; std::cout << "At 2, the calculated value should be 6: " << myPoly2.Value(float(2), true) << std::endl; //exceptions for spline std::cout<<"Testing spline with to few Points:" << std::endl; try { ... ... @@ -182,47 +183,49 @@ bool GeneralTest(){ catch (ITAException& err) { std::cout << err << std::endl; } return true; */ /* // // ALLES MIT DOUBLES // //the following data is random. std::vector vdSupportingPoints{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector vdDataPoints{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; std::vector vdX = { -10, 1.5, -7.898,3.3, 3.3,9.9,-2.5,8.9,0.01,-4.3 }; CPiecewisePolynomial myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); std::vector vdSupportingPoints_double{ -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::vector vdDataPoints_double{ 77, 80, 19, 49, 45, 65, 71, 76, 28, 68, 66, 17,12, 50, 96, 35, 59, 23, 76, 26, 51 }; std::vector vdX_double = { -10, 1.5, -7.898,3.3, 3.3,9.9,-2.5,8.9,0.01,-4.3 }; CPiecewisePolynomial myPoly_double = CubicSpline(vdSupportingPoints_double, vdDataPoints_double); std::cout< vdBreakPoints = { 0, 1 }; std::vector vdCoeff = { 1,1,1 }; int iOrder = 2; CPiecewisePolynomial myPoly2 = CPiecewisePolynomial(vdBreakPoints, vdCoeff, iOrder); std::vector vdBreakPoints_double = { 0, 1 }; std::vector vdCoeff_double = { 1,1,1 }; int iOrder2 = 2; CPiecewisePolynomial myPoly2_double = CPiecewisePolynomial(vdBreakPoints_double, vdCoeff_double, iOrder2); //deviation test CPiecewisePolynomial myPoly3 = myPoly2.Derivation(); std::cout << "The deviation of x^2+x+1 should be: " << myPoly3.Coefficients()[0] << " * x + " << myPoly3.Coefficients()[1] << std::endl; std::cout << "so the new polynoial only got " << myPoly3.NumCoefficients() << " coefficients." << std::endl; CPiecewisePolynomial myPoly3_double = myPoly2_double.Derivation(); std::cout << "The deviation of x^2+x+1 should be: " << myPoly3_double.Coefficients()[0] << " * x + " << myPoly3_double.Coefficients()[1] << std::endl; std::cout << "so the new polynoial only got " << myPoly3_double.NumCoefficients() << " coefficients." << std::endl; //exceptions for Piecewise Polynoms std::cout << "Testing the Value function with Argument out of it's range, without extrapolation:" << std::endl; try { myPoly2.Value(-2); } try { myPoly2_double.Value(-2.0); } catch (ITAException& err) { std::cout << err << std::endl; } std::cout << "Testing the Value function with Arguments out of it's range, with extrapolation:" << std::endl; std::cout << "At -2, the calculated value should be -1: " << myPoly2.Value(-2, true) << std::endl; std::cout << "At 2, the calculated value should be 6: " << myPoly2.Value(2, true) << std::endl; std::cout << "At -2, the calculated value should be -1: " << myPoly2_double.Value(-2.0, true) << std::endl; std::cout << "At 2, the calculated value should be 6: " << myPoly2_double.Value(2.0, true) << std::endl; //exceptions for spline std::cout << "Testing spline with to few Points:" << std::endl; try { std::vector vdSupportingPoints{ -10, -9 }; std::vector vdDataPoints{ 77, 80 }; myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); myPoly_double = CubicSpline(vdSupportingPoints, vdDataPoints); } catch (ITAException& err) { std::cout << err << std::endl; ... ... @@ -231,7 +234,7 @@ bool GeneralTest(){ try { std::vector vdSupportingPoints{ -10, -5 ,-1,0,3 };//5points std::vector vdDataPoints{ 77, 80,4,5,-4,-1 };//6 Points myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); myPoly_double = CubicSpline(vdSupportingPoints, vdDataPoints); } catch (ITAException& err) { std::cout << err << std::endl; ... ... @@ -240,12 +243,25 @@ bool GeneralTest(){ try { std::vector vdSupportingPoints{ -10, 5 ,-1,0,3 }; std::vector vdDataPoints{ 77, 80,4,5,-4 }; myPoly = CubicSpline(vdSupportingPoints, vdDataPoints); myPoly_double = CubicSpline(vdSupportingPoints, vdDataPoints); } catch (ITAException& err) { std::cout << err << std::endl; } */ // // JETZT ALLE PERMUTATIONEN AN BERGABEPARAMETERN FR DIE KONSTRUKTOREN TESTEN // CPiecewisePolynomial mySpline1 = CubicSpline(vdSupportingPoints, vdDataPoints); CPiecewisePolynomial mySpline2 = CubicSpline(vdSupportingPoints_double, vdDataPoints); CPiecewisePolynomial mySpline3 = CubicSpline(vdSupportingPoints, vdDataPoints_double); CPiecewisePolynomial mySpline4 = CubicSpline(vdSupportingPoints_double, vdDataPoints_double); std::vector myResult1 = CubicSpline(vdSupportingPoints_double, vdDataPoints_double,vdX_double); std::vector myResult2 = CubicSpline(vdSupportingPoints, vdDataPoints, vdX); float myResult3 = CubicSpline(vdSupportingPoints, vdDataPoints, float(1)); double myResult4 = CubicSpline(vdSupportingPoints_double, vdDataPoints_double, double(1)); std::cout<< std::endl << "Es wurden erfolgreich alle Konstruktoren getestet" << std::endl; return true; } ... ... @@ -253,7 +269,7 @@ bool GeneralTest(){ //! SplineTest.cpp consists of several Test for Speed, functionality and DataExport to MATLAB, to compare and plot splines int main(int iNumInArgs, char* pcInArgs[]) { /* std::cout << "Checking starts" << std::endl; std::cout << "Test 1: general Test for functions" << std::endl << std::endl; GeneralTest(); ... ... @@ -262,6 +278,6 @@ int main(int iNumInArgs, char* pcInArgs[]) std::cout << "The next function will write 3 .txt files that need to be imported to MATLAB with the help of SplineTest.m" << std::endl; Compare2MATLAB(); */ return 0; }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!