Skip to content

use BFGS optimization algorithm to solve problems like curve fitting

Notifications You must be signed in to change notification settings

luchangli03/BFGS-Optimization-for-curve-fitting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BFGS-Optimization-for-curve-fitting C++

use BFGS optimization algorithm to solve problems like curve fitting the codes contain two part: a BFGS optimizer and some curve fitting example. I also uploaded a code file to verify these codes.

the codes are very simple to use, just as shown below

#include <iostream>
using namespace std;

#include "CurveFitting.h"


int main()
{
#define DataLen	10
float x[DataLen] = { 0,1,2,3,4,5,6,7,8,9 };
float y[DataLen] = { 0.601981941401637,1.26297128454014,2.65407909847678,3.68921450314001,4.74815159282371,5.45054159850250,6.08382137799693,7.22897696871682,8.91333736150167,9.15237801896922 };

#define DataArrayNum		2

float *DataArray[DataArrayNum] = { x,y };


BFGSOptimizer_TypeDef< float, DataArrayNum, 2, 5, 11>BFGSOptimizer(LineOrder1_PreFitting, LineOrder1_TargerF);

BFGSOptimizer.BFGSOptimize(DataArray, DataLen);

BFGSOptimizer.PrintfFitPara();

return 0;
}

About

use BFGS optimization algorithm to solve problems like curve fitting

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages