提交 87bd3db4 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Remove section titles in the docstring (they don't show up and cause warnings).

上级 52903ced
...@@ -863,18 +863,21 @@ class FillDiagonalOffset(gof.Op): ...@@ -863,18 +863,21 @@ class FillDiagonalOffset(gof.Op):
return [wr_a, wr_val,wr_offset] return [wr_a, wr_val,wr_offset]
fill_diagonal_offset = FillDiagonalOffset() fill_diagonal_offset_ = FillDiagonalOffset()
""" Returns a copy of an array with all
def fill_diagonal_offset(a, val, offset):
"""
Returns a copy of an array with all
elements of the main diagonal set to a specified scalar value. elements of the main diagonal set to a specified scalar value.
:param a: Rectangular array of two dimensions. :param a: Rectangular array of two dimensions.
:param val: Scalar value to fill the diagonal whose type must be :param val: Scalar value to fill the diagonal whose type must be
compatible with that of array 'a' (i.e. 'val' cannot be viewed compatible with that of array 'a' (i.e. 'val' cannot be viewed
as an upcast of 'a'). as an upcast of 'a').
:params offset : Scalar value Offset of the diagonal from the main :param offset: Scalar value Offset of the diagonal from the main
diagonal. Can be positive or negative integer. diagonal. Can be positive or negative integer.
:return: An array identical to 'a' except that its offset diagonal :return: An array identical to 'a' except that its offset diagonal
is filled with scalar 'val'. The output is unwrapped. is filled with scalar 'val'. The output is unwrapped.
"""
""" return fill_diagonal_offset_(a, val, offset)
...@@ -496,20 +496,35 @@ def qr(a, mode="full"): ...@@ -496,20 +496,35 @@ def qr(a, mode="full"):
Factor the matrix a as qr, where q Factor the matrix a as qr, where q
is orthonormal and r is upper-triangular. is orthonormal and r is upper-triangular.
Parameters : :type a:
------------ array_like, shape (M, N)
:param a:
a : array_like, shape (M, N)
Matrix to be factored. Matrix to be factored.
mode : {'reduced', 'complete', 'r', 'raw', 'full', 'economic'}, optional :type mode:
one of 'reduced', 'complete', 'r', 'raw', 'full' and
'economic', optional
:keyword mode:
If K = min(M, N), then If K = min(M, N), then
'reduced' : returns q, r with dimensions (M, K), (K, N) (default)
'complete' : returns q, r with dimensions (M, M), (M, N) 'reduced'
'r' : returns r only with dimensions (K, N) returns q, r with dimensions (M, K), (K, N)
'raw' : returns h, tau with dimensions (N, M), (K,)
'full' : alias of 'reduced', deprecated 'complete'
'economic' : returns h from 'raw', deprecated. The options 'reduced', returns q, r with dimensions (M, M), (M, N)
'r'
returns r only with dimensions (K, N)
'raw'
returns h, tau with dimensions (N, M), (K,)
'full'
alias of 'reduced', deprecated (default)
'economic'
returns h from 'raw', deprecated. The options 'reduced',
'complete', and 'raw' are new in numpy 1.8, see the notes for more 'complete', and 'raw' are new in numpy 1.8, see the notes for more
information. The default is 'reduced' and to maintain backward information. The default is 'reduced' and to maintain backward
compatibility with earlier versions of numpy both it and the old compatibility with earlier versions of numpy both it and the old
...@@ -518,21 +533,25 @@ def qr(a, mode="full"): ...@@ -518,21 +533,25 @@ def qr(a, mode="full"):
deprecated. The modes 'full' and 'economic' may be passed using only deprecated. The modes 'full' and 'economic' may be passed using only
the first letter for backwards compatibility, but all others the first letter for backwards compatibility, but all others
must be spelled out. must be spelled out.
Default mode is 'full' which is also default for numpy 1.6.1. Default mode is 'full' which is also default for numpy 1.6.1.
Note: Default mode was left to full as full and reduced are both doing :note: Default mode was left to full as full and reduced are
the same thing in the new numpy version but only full works on the old both doing the same thing in the new numpy version but only
previous numpy version. full works on the old previous numpy version.
Returns :
--------- :rtype q:
q : matrix of float or complex, optional matrix of float or complex, optional
A matrix with orthonormal columns. When mode = 'complete' :return q:
the result is an orthogonal/unitary matrix depending on whether A matrix with orthonormal columns. When mode = 'complete' the
or not a is real/complex. The determinant may be either +/- 1 in that case. result is an orthogonal/unitary matrix depending on whether or
not a is real/complex. The determinant may be either +/- 1 in
r : matrix of float or complex, optional that case.
:rtype r:
matrix of float or complex, optional
:return r:
The upper-triangular matrix. The upper-triangular matrix.
""" """
x = [[2, 1], [3, 4]] x = [[2, 1], [3, 4]]
if isinstance(numpy.linalg.qr(x,mode), tuple): if isinstance(numpy.linalg.qr(x,mode), tuple):
...@@ -549,8 +568,6 @@ class SVD(Op): ...@@ -549,8 +568,6 @@ class SVD(Op):
def __init__(self, full_matrices=True, compute_uv=True): def __init__(self, full_matrices=True, compute_uv=True):
""" """
inputs :
--------
full_matrices : bool, optional full_matrices : bool, optional
If True (default), u and v have the shapes (M, M) and (N, N), If True (default), u and v have the shapes (M, M) and (N, N),
respectively. respectively.
...@@ -582,21 +599,18 @@ def svd(a, full_matrices=1, compute_uv=1): ...@@ -582,21 +599,18 @@ def svd(a, full_matrices=1, compute_uv=1):
""" """
This function performs the SVD on CPU. This function performs the SVD on CPU.
Parameters : :type full_matrices: bool, optional
------------ :param full_matrices:
full_matrices : bool, optional
If True (default), u and v have the shapes (M, M) and (N, N), If True (default), u and v have the shapes (M, M) and (N, N),
respectively. respectively.
Otherwise, the shapes are (M, K) and (K, N), respectively, Otherwise, the shapes are (M, K) and (K, N), respectively,
where K = min(M, N). where K = min(M, N).
compute_uv : bool, optional :type compute_uv: bool, optional
:param compute_uv:
Whether or not to compute u and v in addition to s. Whether or not to compute u and v in addition to s.
True by default. True by default.
Returns : :returns: U, V and D matrices.
-------
U, V and D matrices.
""" """
return SVD(full_matrices, compute_uv)(a) return SVD(full_matrices, compute_uv)(a)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论