numdifftools.tests package¶
Submodules¶
numdifftools.tests.conftest module¶
Dummy conftest.py for numdifftools.
If you don’t know what this is for, just leave it empty. Read more about conftest.py under: https://pytest.org/latest/plugins.html
numdifftools.tests.test_extrapolation module¶
numdifftools.tests.test_hessian module¶
-
class
numdifftools.tests.test_hessian.
ClassicalHamiltonian
¶ Bases:
object
Hamiltonian
Parameters: N : scalar
number of ions in the chain
w : scalar
angular trap frequency
C : scalar
Coulomb constant times the electronic charge in SI units.
m : scalar
the mass of a single trapped ion in the chain
-
initialposition
()¶ Defines initial position as an estimate for the minimize process.
-
normal_modes
(eigenvalues)¶ Return normal modes
the computed eigenvalues of the matrix Vx are of the form (normal_modes)2*m.
-
potential
(positionvector)¶ Return potential
positionvector is an 1-d array (vector) of length N that contains the positions of the N ions
-
numdifftools.tests.test_limits module¶
Created on 28. aug. 2015
@author: pab
-
class
numdifftools.tests.test_limits.
TestCStepGenerator
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
numdifftools.tests.test_multicomplex module¶
Created on 22. apr. 2015
@author: pab
numdifftools.tests.test_nd_algopy module¶
-
class
numdifftools.tests.test_nd_algopy.
TestDerivative
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_nd_algopy.
TestGradient
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_nd_algopy.
TestHessdiag
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_nd_algopy.
TestHessian
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
numdifftools.tests.test_numdifftools module¶
Test functions for numdifftools module
-
class
numdifftools.tests.test_numdifftools.
TestDerivative
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_numdifftools.
TestGradient
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_numdifftools.
TestHessdiag
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_numdifftools.
TestHessian
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_numdifftools.
TestJacobian
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
class
numdifftools.tests.test_numdifftools.
TestRichardson
(methodName='runTest')[source][source]¶ Bases:
unittest.case.TestCase
-
numdifftools.tests.test_numdifftools.
approx_fprime
(x, f, epsilon=None, args=(), kwargs=None, centered=True)[source][source]¶ Gradient of function, or Jacobian if function fun returns 1d array
Parameters: x : array
parameters at which the derivative is evaluated
fun : function
fun(*((x,)+args), **kwargs) returning either one value or 1d array
epsilon : float, optional
Stepsize, if None, optimal stepsize is used. This is EPS**(1/2)*x for centered == False and EPS**(1/3)*x for centered == True.
args : tuple
Tuple of additional arguments for function fun.
kwargs : dict
Dictionary of additional keyword arguments for function fun.
centered : bool
Whether central difference should be returned. If not, does forward differencing.
Returns: grad : array
gradient or Jacobian
Notes
If fun returns a 1d array, it returns a Jacobian. If a 2d array is returned by fun (e.g., with a value for each observation), it returns a 3d array with the Jacobian of each observation with shape xk x nobs x xk. I.e., the Jacobian of the first observation would be [:, 0, :]
numdifftools.tests.test_numdifftools_docstrings module¶
-
numdifftools.tests.test_numdifftools_docstrings.
load_tests
(loader=None, tests=None, ignore=None)¶
-
numdifftools.tests.test_numdifftools_docstrings.
suite
()¶