Home | Trees | Indices | Help |
---|
|
Core functions used by unumpy and some of its submodules.
(c) 2010-2013 by Eric O. LEBIGOT (EOL).
Author: Eric O. LEBIGOT (EOL) <eric.lebigot@normalesup.org>
|
|||
matrix Class equivalent to numpy.matrix, but that behaves better when the matrix contains numbers with uncertainties. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
to_nominal_values = numpy.vectorize(uncertainties.nominal_valu
|
|||
to_std_devs = numpy.vectorize(uncertainties.std_dev, otypes= [
|
|||
_uarray = numpy.vectorize(lambda v, s: uncertainties.Variable(
|
|||
_pinv_default = 1e-15
|
|||
__package__ =
|
|||
arccos = <numpy.lib.function_base.vectorize object at 0x10e669
|
|||
arccosh = <numpy.lib.function_base.vectorize object at 0x10e66
|
|||
arcsin = <numpy.lib.function_base.vectorize object at 0x10e669
|
|||
arctan = <numpy.lib.function_base.vectorize object at 0x10e669
|
|||
arctan2 = <numpy.lib.function_base.vectorize object at 0x10e66
|
|||
arctanh = <numpy.lib.function_base.vectorize object at 0x10e66
|
|||
asinh = <numpy.lib.function_base.vectorize object at 0x10e669d50>
|
|||
ceil = <numpy.lib.function_base.vectorize object at 0x10e669e50>
|
|||
copysign = <numpy.lib.function_base.vectorize object at 0x10e6
|
|||
cos = <numpy.lib.function_base.vectorize object at 0x10e669ed0>
|
|||
cosh = <numpy.lib.function_base.vectorize object at 0x10e669f10>
|
|||
degrees = <numpy.lib.function_base.vectorize object at 0x10e66
|
|||
erf = <numpy.lib.function_base.vectorize object at 0x10e669f90>
|
|||
erfc = <numpy.lib.function_base.vectorize object at 0x10e669fd0>
|
|||
exp = <numpy.lib.function_base.vectorize object at 0x10e67c050>
|
|||
expm1 = <numpy.lib.function_base.vectorize object at 0x10e67c090>
|
|||
fabs = <numpy.lib.function_base.vectorize object at 0x10e67c0d0>
|
|||
floor = <numpy.lib.function_base.vectorize object at 0x10e67c110>
|
|||
fmod = <numpy.lib.function_base.vectorize object at 0x10e67c150>
|
|||
gamma = <numpy.lib.function_base.vectorize object at 0x10e67c190>
|
|||
hypot = <numpy.lib.function_base.vectorize object at 0x10e67c1d0>
|
|||
isinf = <numpy.lib.function_base.vectorize object at 0x10e67c210>
|
|||
isnan = <numpy.lib.function_base.vectorize object at 0x10e67c250>
|
|||
ldexp = <numpy.lib.function_base.vectorize object at 0x10e67c5d0>
|
|||
lgamma = <numpy.lib.function_base.vectorize object at 0x10e67c
|
|||
log = <numpy.lib.function_base.vectorize object at 0x10e67c2d0>
|
|||
log10 = <numpy.lib.function_base.vectorize object at 0x10e67c310>
|
|||
log1p = <numpy.lib.function_base.vectorize object at 0x10e67c350>
|
|||
modf = <numpy.lib.function_base.vectorize object at 0x10e67c590>
|
|||
pow = <numpy.lib.function_base.vectorize object at 0x10e67c390>
|
|||
radians = <numpy.lib.function_base.vectorize object at 0x10e67
|
|||
sin = <numpy.lib.function_base.vectorize object at 0x10e67c410>
|
|||
sinh = <numpy.lib.function_base.vectorize object at 0x10e67c450>
|
|||
sqrt = <numpy.lib.function_base.vectorize object at 0x10e67c490>
|
|||
tan = <numpy.lib.function_base.vectorize object at 0x10e67c4d0>
|
|||
tanh = <numpy.lib.function_base.vectorize object at 0x10e67c510>
|
|||
trunc = <numpy.lib.function_base.vectorize object at 0x10e67c550>
|
|
If arr in a unumpy.matrix, it is converted to a numpy.matrix. Otherwise, it is returned unchanged. |
Returns the nominal values of the numbers in NumPy array arr. Elements that are not uncertainties.AffineScalarFunc are passed through untouched (because a numpy.array can contain numbers with uncertainties and pure floats simultaneously). If arr is of type unumpy.matrix, the returned array is a numpy.matrix, because the resulting matrix does not contain numbers with uncertainties. |
Returns the standard deviations of the numbers in NumPy array arr. Elements that are not uncertainties.AffineScalarFunc are given a zero uncertainty ((because a numpy.array can contain numbers with uncertainties and pure floats simultaneously).. If arr is of type unumpy.matrix, the returned array is a numpy.matrix, because the resulting matrix does not contain numbers with uncertainties. |
Returns the derivative of u along var, if u is an uncertainties.AffineScalarFunc instance, and if var is one of the variables on which it depends. Otherwise, return 0. |
Returns a version of the function func() that works even when func() is given a NumPy array that contains numbers with uncertainties. func() is supposed to return a NumPy array. This wrapper is similar to uncertainties.wrap(), except that it handles an array argument instead of float arguments. func -- version that takes and returns a single NumPy array. |
Returns a NumPy array of numbers with uncertainties initialized with the given nominal values and standard deviations. values, std_devs -- valid arguments for numpy.array, with identical shapes (list of numbers, list of lists, numpy.ndarray, etc.). |
Returns the derivative of the given array with respect to the given variable. The returned derivative is a Numpy ndarray of the same shape as array_like, that contains floats. array_like -- array-like object (list, etc.) that contains scalars or numbers with uncertainties. var -- Variable object. |
Returns a function that can be applied to array-like objects that contain numbers with uncertainties (lists, lists of lists, Numpy arrays, etc.). func_with_derivatives -- defines a function that takes array-like objects containing scalars and returns an array. Both the value and the derivatives of this function with respect to multiple scalar parameters are calculated by func_with_derivatives(). func_with_derivatives(arr, input_type, derivatives, *args) returns an iterator. The first element is the value of the function at point 'arr' (with the correct type). The following elements are arrays that represent the derivative of the function for each derivative array from the iterator 'derivatives'. func_with_derivatives takes the following arguments: arr -- Numpy ndarray of scalars where the function must be evaluated. input_type -- type of the input array-like object. This type is used for determining the type that the function should return. derivatives -- iterator that returns the derivatives of the argument of the function with respect to multiple scalar variables. func_with_derivatives() returns the derivatives of the defined function with respect to these variables. args -- additional arguments that define the result (example: for the pseudo-inverse numpy.linalg.pinv: numerical cutoff). Examples of func_with_derivatives: inv_with_derivatives(). |
Defines the matrix inverse and its derivatives. See the definition of func_with_deriv_to_uncert_func() for its detailed semantics. |
Version of numpy.linalg.inv that works with array-like objects that contain numbers with uncertainties. The result is a unumpy.matrix if numpy.linalg.pinv would return a matrix for the array of nominal values. Analytical formulas are used. Original documentation: Compute the (multiplicative) inverse of a matrix. Given a square matrix `a`, return the matrix `ainv` satisfying ``dot(a, ainv) = dot(ainv, a) = eye(a.shape[0])``. Parameters ---------- a : (..., M, M) array_like Matrix to be inverted. Returns ------- ainv : (..., M, M) ndarray or matrix (Multiplicative) inverse of the matrix `a`. Raises ------ LinAlgError If `a` is not square or inversion fails. Notes ----- .. versionadded:: 1.8.0 Broadcasting rules apply, see the `numpy.linalg` documentation for details. Examples -------- >>> from numpy.linalg import inv >>> a = np.array([[1., 2.], [3., 4.]]) >>> ainv = inv(a) >>> np.allclose(np.dot(a, ainv), np.eye(2)) True >>> np.allclose(np.dot(ainv, a), np.eye(2)) True If a is a matrix object, then the return value is a matrix as well: >>> ainv = inv(np.matrix(a)) >>> ainv matrix([[-2. , 1. ], [ 1.5, -0.5]]) Inverses of several matrices can be computed at once: >>> a = np.array([[[1., 2.], [3., 4.]], [[1, 3], [3, 5]]]) >>> inv(a) array([[[-2. , 1. ], [ 1.5, -0.5]], [[-5. , 2. ], [ 3. , -1. ]]]) |
Defines the matrix pseudo-inverse and its derivatives. Works with real or complex matrices. See the definition of func_with_deriv_to_uncert_func() for its detailed semantics. |
array_like -- array-like object that contains numbers with uncertainties (list, Numpy ndarray or matrix, etc.). args -- additional arguments that are passed directly to func_with_derivatives. |
Version of numpy.linalg.pinv that works with array-like objects that contain numbers with uncertainties. The result is a unumpy.matrix if numpy.linalg.pinv would return a matrix for the array of nominal values. Analytical formulas are used. Original documentation: Compute the (Moore-Penrose) pseudo-inverse of a matrix. Calculate the generalized inverse of a matrix using its singular-value decomposition (SVD) and including all *large* singular values. Parameters ---------- a : (M, N) array_like Matrix to be pseudo-inverted. rcond : float Cutoff for small singular values. Singular values smaller (in modulus) than `rcond` * largest_singular_value (again, in modulus) are set to zero. Returns ------- B : (N, M) ndarray The pseudo-inverse of `a`. If `a` is a `matrix` instance, then so is `B`. Raises ------ LinAlgError If the SVD computation does not converge. Notes ----- The pseudo-inverse of a matrix A, denoted :math:`A^+`, is defined as: "the matrix that 'solves' [the least-squares problem] :math:`Ax = b`," i.e., if :math:`\bar{x}` is said solution, then :math:`A^+` is that matrix such that :math:`\bar{x} = A^+b`. It can be shown that if :math:`Q_1 \Sigma Q_2^T = A` is the singular value decomposition of A, then :math:`A^+ = Q_2 \Sigma^+ Q_1^T`, where :math:`Q_{1,2}` are orthogonal matrices, :math:`\Sigma` is a diagonal matrix consisting of A's so-called singular values, (followed, typically, by zeros), and then :math:`\Sigma^+` is simply the diagonal matrix consisting of the reciprocals of A's singular values (again, followed by zeros). [1]_ References ---------- .. [1] G. Strang, *Linear Algebra and Its Applications*, 2nd Ed., Orlando, FL, Academic Press, Inc., 1980, pp. 139-142. Examples -------- The following example checks that ``a * a+ * a == a`` and ``a+ * a * a+ == a+``: >>> a = np.random.randn(9, 6) >>> B = np.linalg.pinv(a) >>> np.allclose(a, np.dot(a, np.dot(B, a))) True >>> np.allclose(B, np.dot(B, np.dot(a, B))) True
|
Constructs a matrix that contains numbers with uncertainties. The input data is the same as for uarray(...): a tuple with the nominal values, and the standard deviations. The returned matrix can be inverted, thanks to the fact that it is a unumpy.matrix object instead of a numpy.matrix one. |
Defines vectorized versions of functions from uncertainties.umath. Some functions have their name translated, so as to follow NumPy's convention (example: math.acos -> numpy.arccos). |
|
to_nominal_values
|
to_std_devs
|
_uarray
|
__package__
|
arccos
|
arccosh
|
arcsin
|
arctan
|
arctan2
|
arctanh
|
copysign
|
degrees
|
lgamma
|
radians
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Nov 7 18:01:56 2016 | http://epydoc.sourceforge.net |