gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat
-rw-r--r--help.lua 2
-rw-r--r--help/nlfit.lua 48
-rw-r--r--num.lua 5
3 files changed, 53 insertions, 2 deletions
diff --git a/help.lua b/help.lua
index 279ddc20..edd3aa7f 100644
--- a/help.lua
+++ b/help.lua
@@ -1,5 +1,5 @@
-local help_files = {'graphics', 'matrix', 'iter', 'integ', 'ode'}
+local help_files = {'graphics', 'matrix', 'iter', 'integ', 'ode', 'nlfit'}
local function help_init( ... )
local REG = debug.getregistry()
diff --git a/help/nlfit.lua b/help/nlfit.lua
new file mode 100644
index 00000000..5fe6153e
--- /dev/null
+++ b/help/nlfit.lua
@@ -0,0 +1,48 @@
+
+local REG = debug.getregistry()
+NLFIT = REG['GSL.NLINFIT']
+
+local M = {
+ [num.nlinfit] = [[
+num.nlinfit {n= <int>, p= <int>}
+
+ Create a non-linear fit solver object for a system of dimension "n"
+ with "p" fitting parameters.
+]],
+
+ [NLFIT.set] = [[
+<nlfit>:set(fdf, x0)
+
+ Associate the non-linear fit solver with the user-defined function
+ fdf and set the initial condition for the fit parameters to x0.
+ The function fdf will be called in the form
+
+ fdf(x, f, J)
+
+ where x is a column matrix with the fit parameters, f is either
+ nil or a column matrix of dimension n to store the values f(x_i) -
+ y_i. J is either nil or a matrix of dimension n x p to store the
+ Jacobian of f versus the fit parameters:
+
+ J[i, j] = d f_i / d x_j
+
+ The function fdf should set all the elements of f and J if they
+ are not nil.
+]],
+
+ [NLFIT.iterate] = [[
+<nlfit>:iterate()
+
+ Advance the solver of a single step. It does return "continue" if
+ it did not reach the optimal point and "success" otherwise.
+]],
+
+ [NLFIT.test] = [[
+<nlfit>:test(eps_abs, eps_err)
+
+ Check if the the search converged for the given absolute error
+ eps_abs and relative error eps_rel.
+]],
+}
+
+return M
diff --git a/num.lua b/num.lua
index f835a688..fb254a79 100644
--- a/num.lua
+++ b/num.lua
@@ -1,6 +1,8 @@
local template = require 'template'
+local REG = debug.getregistry()
+
num = {}
function num.ode(spec)
@@ -23,7 +25,6 @@ function num.ode(spec)
local ode = template.load(method, spec)
- local REG = debug.getregistry()
REG['GSL.help_hook'].ODE = ode
local mt = {
@@ -49,6 +50,8 @@ local NLINFIT = {
end
}
+REG['GSL.NLINFIT'] = NLINFIT_METHODS
+
function num.nlinfit(spec)
if not spec.n then error 'number of points "n" not specified' end
if not spec.p then error 'number of parameters "p" not specified' end
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月17日 19:15:17 +0000

AltStyle によって変換されたページ (->オリジナル) /