* fit_dat removed. Please use datafit instead. 46/14246/1
Vincent COUVERT [Mon, 31 Mar 2014 12:07:03 +0000 (14:07 +0200)]
Change-Id: I0c0e3f8740ff98047a89477a0817fc16b1f203b6

scilab/CHANGES_5.5.X
scilab/modules/helptools/data/configuration/scilab_macros.txt
scilab/modules/optimization/help/en_US/nonlinearleastsquares/datafit.xml
scilab/modules/optimization/help/en_US/nonlinearleastsquares/fit_dat.xml [deleted file]
scilab/modules/optimization/locales/optimization.pot
scilab/modules/optimization/macros/fit_dat.sci [deleted file]
scilab/modules/optimization/tests/nonreg_tests/bug_244.dia.ref
scilab/modules/optimization/tests/nonreg_tests/bug_244.tst

index e5588e8..dc5fe70 100644 (file)
@@ -200,6 +200,8 @@ Obsolete & Removed Functions
 
 * draw removed.
 
+* fit_dat removed. Please use datafit instead.
+
 * regress tagged as obsolete. Will be removed in Scilab 5.5.1.
   Please use reglin instead.
 
index 77c6556..7ba0e55 100644 (file)
             <literal>z_i</literal>. Vector <literal>p</literal> is found by minimizing
             <literal>G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)</literal>
         </para>
-        <para>
-            <literal>datafit</literal> is an improved version of
-            <literal>fit_dat</literal>.
-        </para>
     </refsection>
     <refsection>
         <title>Examples</title>
diff --git a/scilab/modules/optimization/help/en_US/nonlinearleastsquares/fit_dat.xml b/scilab/modules/optimization/help/en_US/nonlinearleastsquares/fit_dat.xml
deleted file mode 100644 (file)
index e67e66b..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA
- * Copyright (C) 2011 - DIGITEO - Michael Baudin
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
- *
- -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="fit_dat" xml:lang="en">
-    <refnamediv>
-        <refname>fit_dat</refname>
-        <refpurpose>
-            Parameter identification based on measured data 
-            <emphasis role="bold">
-                This function is obsolete. Please use <link linkend="datafit">datafit</link>.
-            </emphasis>
-        </refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Calling Sequence</title>
-        <synopsis>[p,err]=fit_dat(G,p0,Z [,W] [,pmin,pmax] [,DG])</synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Arguments</title>
-        <variablelist>
-            <varlistentry>
-                <term>G</term>
-                <listitem>
-                    <para>Scilab function (e=G(p,z), e: nex1, p: npx1, z: nzx1)</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>p0</term>
-                <listitem>
-                    <para>initial guess (size npx1)</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>Z</term>
-                <listitem>
-                    <para>matrix [z_1,z_2,...z_n] where z_i (nzx1) is the ith
-                        measurement
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>W</term>
-                <listitem>
-                    <para>weighting matrix of size nexne (optional; default 1)</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>pmin</term>
-                <listitem>
-                    <para>lower bound on p (optional; size npx1)</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>pmax</term>
-                <listitem>
-                    <para>upper bound on p (optional; size npx1)</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>DG</term>
-                <listitem>
-                    <para>partial of G wrt p (optional; S=DG(p,z), S: nexnp)</para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Description</title>
-        <para>
-            <literal>fit_dat</literal> is used for fitting data to a model. For
-            a given function G(p,z), this function finds the best vector of parameters
-            p for approximating G(p,z_i)=0 for a set of measurement vectors z_i.
-            Vector p is found by minimizing
-            <literal>G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)</literal>
-        </para>
-    </refsection>
-    <refsection>
-        <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
-function y=FF(x)
-  y=a*(x-b)+c*x.*x;
-endfunction
-X=[];
-Y=[];
-a=34;
-b=12;
-c=14;
-for x=0:.1:3
-  Y=[Y,FF(x)+100*(rand()-.5)];
-  X=[X,x];
-end
-Z=[Y;X];
-function e=G(p,z)
-  a=p(1)
-  b=p(2)
-  c=p(3)
-  y=z(1)
-  x=z(2)
-  e=y-FF(x)
-endfunction
-
-[p,err]=fit_dat(G,[3;5;10],Z)
-
-xset('window',0)
-clf();
-plot2d(X',Y',-1) 
-plot2d(X',FF(X)',5,'002')
-a=p(1);
-b=p(2);
-c=p(3);
-plot2d(X',FF(X)',12,'002')
-
-a=34;
-b=12;
-c=14;
-function s=DG(p,z)
-  y=z(1),
-  x=z(2),
-  s=-[x-p(2),-p(1),x*x]
-endfunction
-
-[p,err]=fit_dat(G,[3;5;10],Z,DG)
-
-xset('window',1)
-clf();
-plot2d(X',Y',-1)
-plot2d(X',FF(X)',5,'002')
-a=p(1);
-b=p(2);
-c=p(3);
-plot2d(X',FF(X)',12,'002')
- ]]></programlisting>
-    </refsection>
-    <refsection role="see also">
-        <title>See Also</title>
-        <simplelist type="inline">
-            <member>
-                <link linkend="optim">optim</link>
-            </member>
-            <member>
-                <link linkend="datafit">datafit</link>
-            </member>
-        </simplelist>
-    </refsection>
-    <refsection>
-        <title>History</title>
-        <revhistory>
-            <revision>
-                <revnumber>5.4.1</revnumber>
-                <revdescription>
-                    Function tagged obsolete. Will be removed in 5.5.0. Please use <link linkend="datafit">datafit</link> instead.
-                </revdescription>
-            </revision>
-        </revhistory>
-    </refsection>
-</refentry>
index 2c65d32..0eadda1 100644 (file)
@@ -15,7 +15,7 @@ msgstr ""
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Revision-Date: 2014-03-28 17:39+0100\n"
+"Revision-Date: 2014-03-31 13:55+0100\n"
 
 # File: sci_gateway/c/sci_qld.c, line: 86
 # File: sci_gateway/c/sci_qld.c, line: 112
@@ -902,7 +902,6 @@ msgstr ""
 
 #
 # File: macros/bvodeS.sci, line: 30
-# File: macros/fit_dat.sci, line: 80
 #, c-format
 msgid "%s: Wrong number of input argument(s).\n"
 msgstr ""
@@ -1020,18 +1019,6 @@ msgid "%s: Wrong type for input argument #%d: A function expected.\n"
 msgstr ""
 
 #
-# File: macros/fit_dat.sci, line: 83
-#, c-format
-msgid "%s: Weighting matrix must be square.\n"
-msgstr ""
-
-#
-# File: macros/fit_dat.sci, line: 102
-#, c-format
-msgid "%s: Initial guess not feasible.\n"
-msgstr ""
-
-#
 # File: macros/karmarkar.sci, line: 76
 # File: macros/karmarkar.sci, line: 79
 # File: macros/karmarkar.sci, line: 82
diff --git a/scilab/modules/optimization/macros/fit_dat.sci b/scilab/modules/optimization/macros/fit_dat.sci
deleted file mode 100644 (file)
index 9e68520..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) INRIA
-//
-// This file must be used under the terms of the CeCILL.
-// This source file is licensed as described in the file COPYING, which
-// you should have received as part of this distribution.  The terms
-// are also available at
-// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
-//
-function [p,err]=fit_dat(G,p0,Z,W,pmin,pmax,DG)
-    //
-    //         [p,err]=fit_dat(G,p0,Z [,W] [,pmin,pmax] [,DG])
-    //
-    //         Function used for fitting data to a model.
-    // For a given function G(p,z), this function finds the best vector
-    // of parameters p for approximating G(p,z_i)=0 for a set of measurement
-    // vectors z_i. Vector p is found by minimizing
-    //    G(p,z_1)'WG(p,z_1)+G(p,z_2)'WG(p,z_2)+...+G(p,z_n)'WG(p,z_n)
-    //
-    //      G: Scilab function (e=G(p,z), e: nex1, p: npx1, z: nzx1)
-    //     p0: initial guess (size npx1)
-    //      Z: matrix [z_1,z_2,...z_n] where z_i (nzx1) is the ith measurement
-    //      W: weighting matrix of size nexne (optional; default 1)
-    //   pmin: lower bound on p (optional; size npx1)
-    //   pmax: upper bound on p (optional; size npx1)
-    //     DG: partial of G wrt p (optional; S=DG(p,z), S: nexnp)
-    //
-    //                     Examples
-    //
-    //deff('y=FF(x)','y=a*(x-b)+c*x.*x')
-    //X=[];Y=[];
-    //a=34;b=12;c=14;for x=0:.1:3, Y=[Y,FF(x)+100*(rand-.5)];X=[X,x];end
-    //Z=[Y;X];
-    //deff('e=G(p,z)','a=p(1),b=p(2),c=p(3),y=z(1),x=z(2),e=y-FF(x)')
-    //[p,err]=fit_dat(G,[3;5;10],Z)
-    //xset('window',0)
-    //clf();
-    //plot2d(X',Y',-1)
-    //plot2d(X',FF(X)',5,'002')
-    //a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
-    //
-    //a=34;b=12;c=14;
-    //deff('s=DG(p,z)','y=z(1),x=z(2),s=-[x-p(2),-p(1),x*x]')
-    //[p,err]=fit_dat(G,[3;5;10],Z,DG)
-    //xset('window',1)
-    //clf();
-    //plot2d(X',Y',-1)
-    //plot2d(X',FF(X)',5,'002')
-    //a=p(1),b=p(2),c=p(3);plot2d(X',FF(X)',12,'002')
-    //
-    //
-    warnobsolete("datafit","5.5.0");
-
-    [lhs,rhs]=argn(0)
-    boun=%f
-    if rhs==3 then
-        W=1;GR=%f  //Jacobian not provided
-    elseif rhs==4 then
-        if type(W)==11|type(W)==13 then
-            DG=W;W=1;GR=%t  //Jacobian provided
-        else
-            GR=%f  //Jacobian not provided
-        end
-    elseif rhs==5 then
-        if type(pmin)==1 then
-            pmax=pmin,pmin=W,W=1,GR=%f,boun=%t
-        else
-            DG=pmin;GR=%t
-        end
-    elseif rhs==6 then
-        boun=%t
-        if type(pmax)==1 then
-            GR=%f
-        else
-            DG=pmax,pmax=pmin,pmin=W,W=1,GR=%t
-        end
-    elseif    rhs==7 then
-        GR=%t;
-    else
-        error(msprintf(gettext("%s: Wrong number of input argument(s).\n"),"fit_dat"));
-    end
-    if size(W,1)~=size(W,2) then
-        error(msprintf(gettext("%s: Weighting matrix must be square.\n"),"fit_dat"));
-    end
-    nz=size(Z,2);mz=size(p0,"*");
-    deff("e=GG(p,Z)","e=0;for i=1:nz,e=e+G(p,Z(:,i))''*W*G(p,Z(:,i)),end")
-    if ~GR then
-        deff("g=DGG(ps,Z)",["g=[]";
-        "nrm=norm(ps);if nrm<1 then nrm=1,end";
-        "[d,nu]=colcomp(rand(mz,mz));d=10*%eps*nrm*d";
-        "for v=d,e=GG(ps+v),g=[g,e-f],end;g=g/d;"])
-    else
-        deff("g=DGG(ps,Z)","g=0;for i=1:nz,g=g+2*DG(ps,Z(:,i))''*W*G(ps,Z(:,i)),end")
-    end
-    deff("[f,g,ind]=costf(p,ind)",["f=GG(p,Z);";
-    "g=DGG(p,Z);"])
-
-    if ~boun then
-        [err,p]=optim(costf,p0)
-    else
-        if or(p0<pmin)|or(p0>pmax) then
-            error(msprintf(gettext("%s: Initial guess not feasible.\n"),"fit_dat"));
-        end
-        [err,p]=optim(costf,"b",pmin,pmax,p0)
-    end
-
-endfunction
index 0277bea..6462829 100644 (file)
@@ -4,6 +4,7 @@
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
+// <-- TEST WITH GRAPHIC -->
 // <-- Non-regression test for bug 244 -->
 //
 // <-- Bugzilla URL -->
@@ -150,10 +151,7 @@ Y=[
 // fitting
 Z=[Y;X];
 deff('e=G(p,z)','pK1=p(1),pK2=p(2),v=z(2),pHexp=z(1),e=pHexp-fpH(v)');
-wMode = warning("query");
-warning("off");
-[p,err]=fit_dat(G,[6;7],Z);
-warning(wMode);
+[p,err]=datafit(G,Z,[6;7]);
 // graphic part
 clf()
 //v=[0:1e-5:4.5e-4]
index db097f5..786c3ec 100644 (file)
@@ -163,10 +163,7 @@ Y=[
 // fitting
 Z=[Y;X];
 deff('e=G(p,z)','pK1=p(1),pK2=p(2),v=z(2),pHexp=z(1),e=pHexp-fpH(v)');
-wMode = warning("query");
-warning("off");
-[p,err]=fit_dat(G,[6;7],Z);
-warning(wMode);
+[p,err]=datafit(G,Z,[6;7]);
 
 // graphic part
 clf()