view liboctave/numeric/DASPK-opts.in @ 27918:b442ec6dda5c

use centralized file for copyright info for individual contributors * COPYRIGHT.md: New file. * In most other files, use "Copyright (C) YYYY-YYYY The Octave Project Developers" instead of tracking individual names in separate source files. The motivation is to reduce the effort required to update the notices each year. Until now, the Octave source files contained copyright notices that list individual contributors. I adopted these file-scope copyright notices because that is what everyone was doing 30 years ago in the days before distributed version control systems. But now, with many contributors and modern version control systems, having these file-scope copyright notices causes trouble when we update copyright years or refactor code. Over time, the file-scope copyright notices may become outdated as new contributions are made or code is moved from one file to another. Sometimes people contribute significant patches but do not add a line claiming copyright. Other times, people add a copyright notice for their contribution but then a later refactoring moves part or all of their contribution to another file and the notice is not moved with the code. As a practical matter, moving such notices is difficult -- determining what parts are due to a particular contributor requires a time-consuming search through the project history. Even managing the yearly update of copyright years is problematic. We have some contributors who are no longer living. Should we update the copyright dates for their contributions when we release new versions? Probably not, but we do still want to claim copyright for the project as a whole. To minimize the difficulty of maintaining the copyright notices, I would like to change Octave's sources to use what is described here: https://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html in the section "Maintaining centralized copyright notices": The centralized notice approach consolidates all copyright notices in a single location, usually a top-level file. This file should contain all of the copyright notices provided project contributors, unless the contribution was clearly insignificant. It may also credit -- without a copyright notice -- anyone who helped with the project but did not contribute code or other copyrighted material. This approach captures less information about contributions within individual files, recognizing that the DVCS is better equipped to record those details. As we mentioned before, it does have one disadvantage as compared to the file-scope approach: if a single file is separated from the distribution, the recipient won't see the contributors' copyright notices. But this can be easily remedied by including a single copyright notice in each file's header, pointing to the top-level file: Copyright YYYY-YYYY The Octave Project Developers See the COPYRIGHT file at the top-level directory of this distribution or at https://octave.org/COPYRIGHT.html. followed by the usual GPL copyright statement. For more background, see the discussion here: https://lists.gnu.org/archive/html/octave-maintainers/2020-01/msg00009.html Most files in the following directories have been skipped intentinally in this changeset: doc libgui/qterminal liboctave/external m4
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 15:38:17 -0500
parents 00f796120a6d
children 1891570abac8
line wrap: on
line source

# Copyright (C) 2002-2019 The Octave Project Developers
#
# See the file COPYRIGHT.md in the top-level directory of this distribution
# or <https://octave.org/COPYRIGHT.html/>.
#
#
# This file is part of Octave.
#
# Octave is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Octave is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Octave; see the file COPYING.  If not, see
# <https://www.gnu.org/licenses/>.

CLASS = "DASPK"

INCLUDE = "DAE.h"

OPTION
  NAME = "absolute tolerance"
  DOC_ITEM
Absolute tolerance.  May be either vector or scalar.  If a vector, it
must match the dimension of the state vector, and the relative
tolerance must also be a vector of the same length.

  END_DOC_ITEM
  TYPE = "Array<double>"
  SET_ARG_TYPE = "const $TYPE&"
  INIT_BODY
    $OPTVAR.resize (dim_vector (1, 1));
    $OPTVAR(0) = ::sqrt (std::numeric_limits<double>::epsilon ());
  END_INIT_BODY
  SET_CODE
    void set_$OPT (double val)
      {
        $OPTVAR.resize (dim_vector (1, 1));
        $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ());
        reset = true;
      }

    void set_$OPT (const $TYPE& val)
      { $OPTVAR = val; reset = true; }
  END_SET_CODE
END_OPTION

OPTION
  NAME = "relative tolerance"
  DOC_ITEM
Relative tolerance.  May be either vector or scalar.  If a vector, it
must match the dimension of the state vector, and the absolute
tolerance must also be a vector of the same length.

The local error test applied at each integration step is

@example
@group
  abs (local error in x(i))
       <= rtol(i) * abs (Y(i)) + atol(i)
@end group
@end example

  END_DOC_ITEM
  TYPE = "Array<double>"
  SET_ARG_TYPE = "const $TYPE&"
  INIT_BODY
    $OPTVAR.resize (dim_vector (1, 1));
    $OPTVAR(0) = ::sqrt (std::numeric_limits<double>::epsilon ());
  END_INIT_BODY
  SET_CODE
    void set_$OPT (double val)
      {
        $OPTVAR.resize (dim_vector (1, 1));
        $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (std::numeric_limits<double>::epsilon ());
        reset = true;
      }

    void set_$OPT (const $TYPE& val)
      { $OPTVAR = val; reset = true; }
  END_SET_CODE
END_OPTION

OPTION
  NAME = "compute consistent initial condition"
  DOC_ITEM
Denoting the differential variables in the state vector by @samp{Y_d}
and the algebraic variables by @samp{Y_a}, @code{ddaspk} can solve
one of two initialization problems:

@enumerate
@item Given Y_d, calculate Y_a and Y'_d

@item Given Y', calculate Y.
@end enumerate

In either case, initial values for the given components are input, and
initial guesses for the unknown components must also be provided as
input.  Set this option to 1 to solve the first problem, or 2 to solve
the second (the default is 0, so you must provide a set of
initial conditions that are consistent).

If this option is set to a nonzero value, you must also set the
@qcode{"algebraic variables"} option to declare which variables in the
problem are algebraic.

  END_DOC_ITEM
  TYPE = "octave_idx_type"
  INIT_VALUE = "0"
  SET_EXPR = "val"
END_OPTION

OPTION
  NAME = "use initial condition heuristics"
  DOC_ITEM
Set to a nonzero value to use the initial condition heuristics options
described below.

  END_DOC_ITEM
  TYPE = "octave_idx_type"
  INIT_VALUE = "0"
  SET_EXPR = "val"
END_OPTION

OPTION
  NAME = "initial condition heuristics"
  DOC_ITEM
A vector of the following parameters that can be used to control the
initial condition calculation.

@table @code
@item MXNIT
Maximum number of Newton iterations (default is 5).

@item MXNJ
Maximum number of Jacobian evaluations (default is 6).

@item MXNH
Maximum number of values of the artificial stepsize parameter to be
tried if the @qcode{"compute consistent initial condition"} option has
been set to 1 (default is 5).

Note that the maximum total number of Newton iterations allowed is
@code{MXNIT*MXNJ*MXNH} if the @qcode{"compute consistent initial
condition"} option has been set to 1 and @code{MXNIT*MXNJ} if it is
set to 2.

@item LSOFF
Set to a nonzero value to disable the linesearch algorithm (default is
0).

@item STPTOL
Minimum scaled step in linesearch algorithm (default is eps^(2/3)).

@item EPINIT
Swing factor in the Newton iteration convergence test.  The test is
applied to the residual vector, premultiplied by the approximate
Jacobian.  For convergence, the weighted RMS norm of this vector
(scaled by the error weights) must be less than @code{EPINIT*EPCON},
where @code{EPCON} = 0.33 is the analogous test constant used in the
time steps.  The default is @code{EPINIT} = 0.01.
@end table

  END_DOC_ITEM
  TYPE = "Array<double>"
  SET_ARG_TYPE = "const $TYPE&"
  INIT_BODY
    $OPTVAR.resize (dim_vector (6, 1));
    $OPTVAR(0) = 5.0;
    $OPTVAR(1) = 6.0;
    $OPTVAR(2) = 5.0;
    $OPTVAR(3) = 0.0;
    $OPTVAR(4) = ::pow (std::numeric_limits<double>::epsilon (), 2.0/3.0);
    $OPTVAR(5) = 0.01;
  END_INIT_BODY
  SET_EXPR = "val"
END_OPTION

OPTION
  NAME = "print initial condition info"
  DOC_ITEM
Set this option to a nonzero value to display detailed information
about the initial condition calculation (default is 0).

  END_DOC_ITEM
  TYPE = "octave_idx_type"
  INIT_VALUE = "0"
  SET_EXPR = "val"
END_OPTION

OPTION
  NAME = "exclude algebraic variables from error test"
  DOC_ITEM
Set to a nonzero value to exclude algebraic variables from the error
test.  You must also set the @qcode{"algebraic variables"} option to
declare which variables in the problem are algebraic (default is 0).

  END_DOC_ITEM
  TYPE = "octave_idx_type"
  INIT_VALUE = "0"
  SET_EXPR = "val"
END_OPTION

OPTION
  NAME = "algebraic variables"
  DOC_ITEM
A vector of the same length as the state vector.  A nonzero element
indicates that the corresponding element of the state vector is an
algebraic variable (i.e., its derivative does not appear explicitly
in the equation set).

This option is required by the
@qcode{"compute consistent initial condition"} and
@qcode{"exclude algebraic variables from error test"} options.

  END_DOC_ITEM
  TYPE = "Array<octave_idx_type>"
  SET_ARG_TYPE = const $TYPE&
  INIT_BODY
    $OPTVAR.resize (dim_vector (1, 1));
    $OPTVAR(0) = 0;
  END_INIT_BODY
  SET_CODE
    void set_$OPT (int val)
      {
        $OPTVAR.resize (dim_vector (1, 1));
        $OPTVAR(0) = val;
        reset = true;
      }

    void set_$OPT (const $TYPE& val)
      { $OPTVAR = val; reset = true; }
  END_SET_CODE
END_OPTION

OPTION
  NAME = "enforce inequality constraints"
  DOC_ITEM
Set to one of the following values to enforce the inequality
constraints specified by the @qcode{"inequality constraint types"}
option (default is 0).

@enumerate
@item To have constraint checking only in the initial condition calculation.

@item To enforce constraint checking during the integration.

@item To enforce both options 1 and 2.
@end enumerate

  END_DOC_ITEM
  TYPE = "octave_idx_type"
  INIT_VALUE = "0"
  SET_EXPR = "val"
END_OPTION

OPTION
  NAME = "inequality constraint types"
  DOC_ITEM
A vector of the same length as the state specifying the type of
inequality constraint.  Each element of the vector corresponds to an
element of the state and should be assigned one of the following
codes

@table @asis
@item -2
Less than zero.

@item -1
Less than or equal to zero.

@item 0
Not constrained.

@item 1
Greater than or equal to zero.

@item 2
Greater than zero.
@end table

This option only has an effect if the
@qcode{"enforce inequality constraints"} option is nonzero.

  END_DOC_ITEM
  TYPE = "Array<octave_idx_type>"
  SET_ARG_TYPE = const $TYPE&
  INIT_BODY
    $OPTVAR.resize (dim_vector (1, 1));
    $OPTVAR(0) = 0;
  END_INIT_BODY
  SET_CODE
    void set_$OPT (octave_idx_type val)
      {
        $OPTVAR.resize (dim_vector (1, 1));
        $OPTVAR(0) = val;
        reset = true;
      }

    void set_$OPT (const $TYPE& val)
      { $OPTVAR = val; reset = true; }
  END_SET_CODE
END_OPTION

OPTION
  NAME = "initial step size"
  DOC_ITEM
Differential-algebraic problems may occasionally suffer from severe
scaling difficulties on the first step.  If you know a great deal
about the scaling of your problem, you can help to alleviate this
problem by specifying an initial stepsize (default is computed
automatically).

  END_DOC_ITEM
  TYPE = "double"
  INIT_VALUE = "-1.0"
  SET_EXPR = "(val >= 0.0) ? val : -1.0"
END_OPTION

OPTION
  NAME = "maximum order"
  DOC_ITEM
Restrict the maximum order of the solution method.  This option must
be between 1 and 5, inclusive (default is 5).

  END_DOC_ITEM
  TYPE = "octave_idx_type"
  INIT_VALUE = "5"
  SET_EXPR = "val"
END_OPTION

OPTION
  NAME = "maximum step size"
  DOC_ITEM
Setting the maximum stepsize will avoid passing over very large
regions (default is not specified).
  END_DOC_ITEM
  TYPE = "double"
  INIT_VALUE = "-1.0"
  SET_EXPR = "(val >= 0.0) ? val : -1.0"
END_OPTION