/usr/share/octave/site/m/sundialsTB/kinsol/examples_ser/mkinTest_dns.m is in octave-sundials 2.5.0-3+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | function mkinTest_dns
%mkinTest_dns - KINSOL example problem (serial, dense)
% Simple test problem for the Dense linear solver in KINSOL
% This example solves the system
% y(1)^2 + y(2)^2 = 1
% y(2) = y(1)^2
%
% Radu Serban <radu@llnl.gov>
% Copyright (c) 2005, The Regents of the University of California.
% $Revision: 1.2 $Date: 2007/12/05 21:58:19 $
% Initialize problem
neq = 2;
fnormtol = 1.0e-5;
scsteptol = 1.0e-4;
msbset = 1; % force exact Newton
options = KINSetOptions('FuncNormTol', fnormtol,...
'ScaledStepTol',scsteptol,...
'LinearSolver','Dense',....
'MaxNumSetups', msbset);
KINInit(@sysfn, neq, options);
% Solve problem
y0 = ones(neq,1);
scale = ones(neq,1);
strategy = 'LineSearch';
[status, y] = KINSol(y0, strategy, scale, scale);
% Evaluate system function at solution
[fy, flag] = sysfn(y);
% Print results
fprintf('Solution: %10.4e %10.4e\n', y(1), y(2));
fprintf('Residual: %10.4e %10.4e\n', fy(1), fy(2));
slv_stats = KINGetStats;
ls_stats = slv_stats.LSInfo;
slv_stats
ls_stats
% Free memory
KINFree;
return
% ===================================================================
function [fy, flag] = sysfn(y)
fy(1) = y(1)^2 + y(2)^2 - 1.0;
fy(2) = y(2) - y(1)^2;
flag = 0;
return
|