Saturday, January 9, 2016

On calling Ceres from Scala - 4.0: Hello World

This is the fourth installment of a series documenting my progress on porting the Ceres solver API to Scala. All my sources quoted below are available on github.


Hello World


We are now ready for our first-cut SWIG wrap of the ceres-solver library. The code is in the sandbox section of the skeres github repo, and includes a port to pure Scala of Ceres's helloworld.cc example.

Take a look at the sources, if you wish. I am pressed for time tonight, so will comment on them in a subsequent post. However, I want to post the output of a run just to show it's real:

+ export LD_LIBRARY_PATH=.:/Users/francesco/src/ceres-bin/lib:/opt/twitter/Cellar//glog/0.3.4/lib:/opt/twitter/Cellar//gflags/2.1.2/lib
+ LD_LIBRARY_PATH=.:/Users/francesco/src/ceres-bin/lib:/opt/twitter/Cellar//glog/0.3.4/lib:/opt/twitter/Cellar//gflags/2.1.2/lib
+ scala -classpath classes org.somelightprojections.skeres.HelloWorld
iter cost cost_change |gradient| |step| tr_ratio tr_radius ls_iter iter_time total_time
0 4.512500e+01 0.00e+00 9.50e+00 0.00e+00 0.00e+00 1.00e+04 0 2.23e-03 1.66e-02
1 4.511598e-07 4.51e+01 9.50e-04 9.50e+00 1.00e+00 3.00e+04 1 1.27e-03 1.84e-02
2 5.012552e-16 4.51e-07 3.17e-08 9.50e-04 1.00e+00 9.00e+04 1 3.10e-05 1.85e-02
Ceres Solver Report: Iterations: 2, Initial cost: 4.512500e+01, Final cost: 5.012552e-16, Termination: CONVERGENCE
x : 0.5 -> 9.999999968337555
view raw HelloWorld run hosted with ❤ by GitHub

No comments:

Post a Comment