From a940db3bef884250e82b0962e927281b3c7fa679 Mon Sep 17 00:00:00 2001 From: Michael Hatherly Date: Sun, 13 Dec 2015 10:17:31 +0200 Subject: [PATCH] Rebuild stdlib docs. The only significant changes here seem to be the loss of `.. note::`s. Most other changes are extra `\ ` escapes at the end of inline code, inline math, and links. Some code blocks have been indented by an extra space, I've not managed to track down the cause of that, though they should render the same anyway. `make doctest` errors all look related to differences in backtrace line numbers and aren't related to the changes in this commit. --- doc/stdlib/arrays.rst | 67 ++--- doc/stdlib/base.rst | 93 ++++--- doc/stdlib/collections.rst | 195 ++++++-------- doc/stdlib/dates.rst | 81 +++--- doc/stdlib/file.rst | 63 +++-- doc/stdlib/io-network.rst | 129 +++++---- doc/stdlib/libc.rst | 4 +- doc/stdlib/libdl.rst | 2 +- doc/stdlib/linalg.rst | 525 +++++++++++++++++-------------------- doc/stdlib/math.rst | 468 +++++++++++++-------------------- doc/stdlib/numbers.rst | 62 ++--- doc/stdlib/parallel.rst | 77 +++--- doc/stdlib/pkg.rst | 2 +- doc/stdlib/profile.rst | 36 +-- doc/stdlib/sort.rst | 15 +- doc/stdlib/strings.rst | 28 +- 16 files changed, 794 insertions(+), 1053 deletions(-) diff --git a/doc/stdlib/arrays.rst b/doc/stdlib/arrays.rst index 532696de11f1d..35387ca6ba812 100644 --- a/doc/stdlib/arrays.rst +++ b/doc/stdlib/arrays.rst @@ -13,7 +13,7 @@ Basic functions .. Docstring generated from Julia source - Returns the number of dimensions of ``A`` + Returns the number of dimensions of ``A``\ . .. function:: size(A, [dim...]) @@ -100,7 +100,7 @@ Basic functions .. Docstring generated from Julia source - Convert an array to its complex conjugate in-place + Convert an array to its complex conjugate in-place. .. function:: stride(A, k) @@ -112,7 +112,7 @@ Basic functions .. Docstring generated from Julia source - Returns a tuple of the memory strides in each dimension + Returns a tuple of the memory strides in each dimension. .. function:: ind2sub(dims, index) -> subscripts @@ -126,13 +126,13 @@ Basic functions .. Docstring generated from Julia source - Returns a tuple of subscripts into array ``a`` corresponding to the linear index ``index`` + Returns a tuple of subscripts into array ``a`` corresponding to the linear index ``index``\ . .. function:: sub2ind(dims, i, j, k...) -> index .. Docstring generated from Julia source - The inverse of ``ind2sub``\ , returns the linear index corresponding to the provided subscripts + The inverse of ``ind2sub``\ , returns the linear index corresponding to the provided subscripts. Constructors ------------ @@ -147,7 +147,7 @@ Constructors .. Docstring generated from Julia source - Construct a 1-d array of the specified type. This is usually called with the syntax ``Type[]``. Element values can be specified using ``Type[a,b,c,...]``. + Construct a 1-d array of the specified type. This is usually called with the syntax ``Type[]``\ . Element values can be specified using ``Type[a,b,c,...]``\ . .. function:: cell(dims) @@ -183,13 +183,13 @@ Constructors .. Docstring generated from Julia source - Create a ``BitArray`` with all values set to ``true`` + Create a ``BitArray`` with all values set to ``true``\ . .. function:: falses(dims) .. Docstring generated from Julia source - Create a ``BitArray`` with all values set to ``false`` + Create a ``BitArray`` with all values set to ``false``\ . .. function:: fill(x, dims) @@ -255,13 +255,13 @@ Constructors .. Docstring generated from Julia source - ``n``\ -by-``n`` identity matrix + ``n``\ -by-``n`` identity matrix. .. function:: eye(m, n) .. Docstring generated from Julia source - ``m``\ -by-``n`` identity matrix + ``m``\ -by-``n`` identity matrix. .. function:: eye(A) @@ -323,25 +323,25 @@ Indexing, Assignment, and Concatenation .. Docstring generated from Julia source - Returns a subset of array ``A`` as specified by ``inds``, where each ``ind`` may be an ``Int``, a ``Range``, or a ``Vector``. See the manual section on :ref:`array indexing ` for details. + Returns a subset of array ``A`` as specified by ``inds``\ , where each ``ind`` may be an ``Int``\ , a ``Range``\ , or a ``Vector``\ . See the manual section on :ref:`array indexing ` for details. .. function:: sub(A, inds...) .. Docstring generated from Julia source - Like :func:`getindex`, but returns a view into the parent array ``A`` with the given indices instead of making a copy. Calling :func:`getindex` or :func:`setindex!` on the returned :obj:`SubArray` computes the indices to the parent array on the fly without checking bounds. + Like :func:`getindex`\ , but returns a view into the parent array ``A`` with the given indices instead of making a copy. Calling :func:`getindex` or :func:`setindex!` on the returned :obj:`SubArray` computes the indices to the parent array on the fly without checking bounds. .. function:: parent(A) .. Docstring generated from Julia source - Returns the "parent array" of an array view type (e.g., ``SubArray``\ ), or the array itself if it is not a view + Returns the "parent array" of an array view type (e.g., ``SubArray``\ ), or the array itself if it is not a view. .. function:: parentindexes(A) .. Docstring generated from Julia source - From an array view ``A``\ , returns the corresponding indexes in the parent + From an array view ``A``\ , returns the corresponding indexes in the parent. .. function:: slicedim(A, d, i) @@ -353,7 +353,7 @@ Indexing, Assignment, and Concatenation .. Docstring generated from Julia source - Returns a view of array ``A`` with the given indices like :func:`sub`, but drops all dimensions indexed with scalars. + Returns a view of array ``A`` with the given indices like :func:`sub`\ , but drops all dimensions indexed with scalars. .. function:: setindex!(A, X, inds...) @@ -383,13 +383,13 @@ Indexing, Assignment, and Concatenation .. Docstring generated from Julia source - Concatenate along dimension 1 + Concatenate along dimension 1. .. function:: hcat(A...) .. Docstring generated from Julia source - Concatenate along dimension 2 + Concatenate along dimension 2. .. function:: hvcat(rows::Tuple{Vararg{Int}}, values...) @@ -544,7 +544,7 @@ Indexing, Assignment, and Concatenation .. Docstring generated from Julia source - Like :func:`permutedims`, except the inverse of the given permutation is applied. + Like :func:`permutedims`\ , except the inverse of the given permutation is applied. .. function:: permutedims!(dest, src, perm) @@ -601,10 +601,7 @@ Array functions .. Docstring generated from Julia source - Cumulative product along a dimension ``dim`` (defaults to 1). - See also :func:`cumprod!` to use a preallocated output array, - both for performance and to control the precision of the - output (e.g. to avoid overflow). + Cumulative product along a dimension ``dim`` (defaults to 1). See also :func:`cumprod!` to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow). .. function:: cumprod!(B, A, [dim]) @@ -616,10 +613,7 @@ Array functions .. Docstring generated from Julia source - Cumulative sum along a dimension ``dim`` (defaults to 1). - See also :func:`cumsum!` to use a preallocated output array, - both for performance and to control the precision of the - output (e.g. to avoid overflow). + Cumulative sum along a dimension ``dim`` (defaults to 1). See also :func:`cumsum!` to use a preallocated output array, both for performance and to control the precision of the output (e.g. to avoid overflow). .. function:: cumsum!(B, A, [dim]) @@ -726,8 +720,7 @@ Combinatorics .. Docstring generated from Julia source - Construct a random permutation of length ``n``. The optional ``rng`` argument - specifies a random number generator, see :ref:`Random Numbers `. + Construct a random permutation of length ``n``\ . The optional ``rng`` argument specifies a random number generator, see :ref:`Random Numbers `\ . .. function:: invperm(v) @@ -759,23 +752,19 @@ Combinatorics .. Docstring generated from Julia source - Construct a random cyclic permutation of length ``n``. The optional ``rng`` - argument specifies a random number generator, see :ref:`Random Numbers - `. + Construct a random cyclic permutation of length ``n``\ . The optional ``rng`` argument specifies a random number generator, see :ref:`Random Numbers `\ . .. function:: shuffle([rng,] v) .. Docstring generated from Julia source - Return a randomly permuted copy of ``v``. The optional ``rng`` argument - specifies a random number generator, see :ref:`Random Numbers - `. + Return a randomly permuted copy of ``v``\ . The optional ``rng`` argument specifies a random number generator, see :ref:`Random Numbers `\ . .. function:: shuffle!([rng,] v) .. Docstring generated from Julia source - In-place version of :func:`shuffle`. + In-place version of :func:`shuffle`\ . .. function:: reverse(v [, start=1 [, stop=length(v) ]] ) @@ -793,7 +782,7 @@ Combinatorics .. Docstring generated from Julia source - In-place version of :func:`reverse`. + In-place version of :func:`reverse`\ . BitArrays --------- @@ -802,19 +791,19 @@ BitArrays .. Docstring generated from Julia source - Converts a numeric array to a packed boolean array + Converts a numeric array to a packed boolean array. .. function:: bitunpack(B::BitArray{N}) -> Array{Bool,N} .. Docstring generated from Julia source - Converts a packed boolean array to an array of booleans + Converts a packed boolean array to an array of booleans. .. function:: flipbits!(B::BitArray{N}) -> BitArray{N} .. Docstring generated from Julia source - Performs a bitwise not operation on ``B``. See :ref:`~ operator <~>`. + Performs a bitwise not operation on ``B``\ . See :ref:`~ operator <~>`\ . .. function:: rol!(dest::BitArray{1}, src::BitArray{1}, i::Integer) -> BitArray{1} diff --git a/doc/stdlib/base.rst b/doc/stdlib/base.rst index 7d3fe4ce32739..d7261bad2f5a8 100644 --- a/doc/stdlib/base.rst +++ b/doc/stdlib/base.rst @@ -30,7 +30,7 @@ Getting Around .. Docstring generated from Julia source - Quit the program indicating that the processes completed successfully. This function calls ``exit(0)`` (see :func:`exit`). + Quit the program indicating that the processes completed successfully. This function calls ``exit(0)`` (see :func:`exit`\ ). .. function:: atexit(f) @@ -132,7 +132,7 @@ Getting Around .. Docstring generated from Julia source - Creates a precompiled cache file for module (see help for ``require``) and all of its dependencies. This can be used to reduce package load times. Cache files are stored in ``LOAD_CACHE_PATH[1]``, which defaults to ``~/.julia/lib/VERSION``. See :ref:`Module initialization and precompilation ` for important notes. + Creates a precompiled cache file for module (see help for ``require``\ ) and all of its dependencies. This can be used to reduce package load times. Cache files are stored in ``LOAD_CACHE_PATH[1]``\ , which defaults to ``~/.julia/lib/VERSION``\ . See :ref:`Module initialization and precompilation ` for important notes. .. function:: __precompile__(isprecompilable::Bool=true) @@ -352,37 +352,34 @@ All Objects .. Docstring generated from Julia source - Convert ``x`` to a value of type ``T``. + Convert ``x`` to a value of type ``T``\ . - If ``T`` is an ``Integer`` type, an :exc:`InexactError` will be raised if - ``x`` is not representable by ``T``, for example if ``x`` is not - integer-valued, or is outside the range supported by ``T``. + If ``T`` is an ``Integer`` type, an :exc:`InexactError` will be raised if ``x`` is not representable by ``T``\ , for example if ``x`` is not integer-valued, or is outside the range supported by ``T``\ . .. doctest:: - julia> convert(Int, 3.0) - 3 + julia> convert(Int, 3.0) + 3 - julia> convert(Int, 3.5) - ERROR: InexactError() - in convert at int.jl:209 + julia> convert(Int, 3.5) + ERROR: InexactError() + in convert at int.jl:209 - If ``T`` is a :obj:`AbstractFloat` or :obj:`Rational` type, then it will return - the closest value to ``x`` representable by ``T``. + If ``T`` is a :obj:`AbstractFloat` or :obj:`Rational` type, then it will return the closest value to ``x`` representable by ``T``\ . .. doctest:: - julia> x = 1/3 - 0.3333333333333333 + julia> x = 1/3 + 0.3333333333333333 - julia> convert(Float32, x) - 0.33333334f0 + julia> convert(Float32, x) + 0.33333334f0 - julia> convert(Rational{Int32}, x) - 1//3 + julia> convert(Rational{Int32}, x) + 1//3 - julia> convert(Rational{Int64}, x) - 6004799503160661//18014398509481984 + julia> convert(Rational{Int64}, x) + 6004799503160661//18014398509481984 .. function:: promote(xs...) @@ -556,8 +553,7 @@ Types .. Docstring generated from Julia source - Return ``true`` iff value ``v`` is immutable. See :ref:`man-immutable-composite-types` for a discussion of immutability. - Note that this function works on values, so if you give it a type, it will tell you that a value of ``DataType`` is mutable. + Return ``true`` iff value ``v`` is immutable. See :ref:`man-immutable-composite-types` for a discussion of immutability. Note that this function works on values, so if you give it a type, it will tell you that a value of ``DataType`` is mutable. .. function:: isbits(T) @@ -601,17 +597,17 @@ Types .. Docstring generated from Julia source - Create an :obj:`Enum` type with name ``EnumName`` and enum member values of ``EnumValue1`` and ``EnumValue2`` with optional assigned values of ``x`` and ``y``, respectively. ``EnumName`` can be used just like other types and enum member values as regular values, such as + Create an :obj:`Enum` type with name ``EnumName`` and enum member values of ``EnumValue1`` and ``EnumValue2`` with optional assigned values of ``x`` and ``y``\ , respectively. ``EnumName`` can be used just like other types and enum member values as regular values, such as .. doctest:: - julia> @enum FRUIT apple=1 orange=2 kiwi=3 + julia> @enum FRUIT apple=1 orange=2 kiwi=3 - julia> f(x::FRUIT) = "I'm a FRUIT with value: $(Int(x))" - f (generic function with 1 method) + julia> f(x::FRUIT) = "I'm a FRUIT with value: $(Int(x))" + f (generic function with 1 method) - julia> f(apple) - "I'm a FRUIT with value: 1" + julia> f(apple) + "I'm a FRUIT with value: 1" .. function:: instances(T::Type) @@ -630,8 +626,8 @@ Generic Functions .. doctest:: - julia> method_exists(length, Tuple{Array}) - true + julia> method_exists(length, Tuple{Array}) + true .. function:: applicable(f, args...) -> Bool @@ -699,8 +695,7 @@ Syntax .. Docstring generated from Julia source - Only valid in the context of an ``Expr`` returned from a macro. Prevents the macro hygiene pass from turning embedded variables into gensym variables. See the :ref:`man-macros` - section of the Metaprogramming chapter of the manual for more details and examples. + Only valid in the context of an ``Expr`` returned from a macro. Prevents the macro hygiene pass from turning embedded variables into gensym variables. See the :ref:`man-macros` section of the Metaprogramming chapter of the manual for more details and examples. .. function:: gensym([tag]) @@ -739,15 +734,13 @@ Nullables .. Docstring generated from Julia source - Attempt to access the value of the ``Nullable`` object, ``x``. Returns the - value if it is present; otherwise, throws a ``NullException``. + Attempt to access the value of the ``Nullable`` object, ``x``\ . Returns the value if it is present; otherwise, throws a ``NullException``\ . .. function:: get(x, y) .. Docstring generated from Julia source - Attempt to access the value of the ``Nullable{T}`` object, ``x``. Returns - the value if it is present; otherwise, returns ``convert(T, y)``. + Attempt to access the value of the ``Nullable{T}`` object, ``x``\ . Returns the value if it is present; otherwise, returns ``convert(T, y)``\ . .. function:: isnull(x) @@ -871,9 +864,11 @@ System **Examples**: - * ``run(pipeline(`ls`, `grep xyz`))`` - * ``run(pipeline(`ls`, "out.txt"))`` - * ``run(pipeline("out.txt", `grep xyz`))`` + .. code-block:: julia + + run(pipeline(`ls`, `grep xyz`)) + run(pipeline(`ls`, "out.txt")) + run(pipeline("out.txt", `grep xyz`)) .. function:: pipeline(command; stdin, stdout, stderr, append=false) @@ -883,8 +878,10 @@ System **Examples**: - * ``run(pipeline(`dothings`, stdout="out.txt", stderr="errs.txt"))`` - * ``run(pipeline(`update`, stdout="log.txt", append=true))`` + .. code-block:: julia + + run(pipeline(`dothings`, stdout="out.txt", stderr="errs.txt")) + run(pipeline(`update`, stdout="log.txt", append=true)) .. function:: gethostname() -> AbstractString @@ -920,19 +917,19 @@ System .. Docstring generated from Julia source - Set a timer to be read by the next call to :func:`toc` or :func:`toq`. The macro call ``@time expr`` can also be used to time evaluation. + Set a timer to be read by the next call to :func:`toc` or :func:`toq`\ . The macro call ``@time expr`` can also be used to time evaluation. .. function:: toc() .. Docstring generated from Julia source - Print and return the time elapsed since the last :func:`tic`. + Print and return the time elapsed since the last :func:`tic`\ . .. function:: toq() .. Docstring generated from Julia source - Return, but do not print, the time elapsed since the last :func:`tic`. + Return, but do not print, the time elapsed since the last :func:`tic`\ . .. function:: @time @@ -1005,13 +1002,13 @@ Errors .. Docstring generated from Julia source - Raise an ``ErrorException`` with the given message + Raise an ``ErrorException`` with the given message. .. function:: throw(e) .. Docstring generated from Julia source - Throw an object as an exception + Throw an object as an exception. .. function:: rethrow([e]) @@ -1356,7 +1353,7 @@ Internals .. Docstring generated from Julia source - Prints the LLVM bitcodes generated for running the method matching the given generic function and type signature to :const:`STDOUT`. + Prints the LLVM bitcodes generated for running the method matching the given generic function and type signature to :const:`STDOUT`\ . All metadata and dbg.* calls are removed from the printed bitcode. Use code_llvm_raw for the full IR. diff --git a/doc/stdlib/collections.rst b/doc/stdlib/collections.rst index 158a14831e377..d1c41fe198345 100644 --- a/doc/stdlib/collections.rst +++ b/doc/stdlib/collections.rst @@ -33,19 +33,19 @@ type. .. Docstring generated from Julia source - Get initial iteration state for an iterable object + Get initial iteration state for an iterable object. .. function:: done(iter, state) -> Bool .. Docstring generated from Julia source - Test whether we are done iterating + Test whether we are done iterating. .. function:: next(iter, state) -> item, state .. Docstring generated from Julia source - For a given iterable object and iteration state, return the current item and the next iteration state + For a given iterable object and iteration state, return the current item and the next iteration state. .. function:: zip(iters...) @@ -53,7 +53,7 @@ type. For a set of iterable objects, returns an iterable of tuples, where the ``i``\ th tuple contains the ``i``\ th component of each input iterable. - Note that :func:`zip` is its own inverse: ``collect(zip(zip(a...)...)) == collect(a)``. + Note that :func:`zip` is its own inverse: ``collect(zip(zip(a...)...)) == collect(a)``\ . .. function:: enumerate(iter) @@ -189,13 +189,7 @@ Iterable Collections .. Docstring generated from Julia source - Determine whether an item is in the given collection, in the sense that it is - ``==`` to one of the values generated by iterating over the collection. - Some collections need a slightly different definition; for example :obj:`Set`\ s - check whether the item :func:`isequal` to one of the elements. :obj:`Dict`\ s look for - ``(key,value)`` pairs, and the key is compared using :func:`isequal`. To test - for the presence of a key in a dictionary, use :func:`haskey` or - ``k in keys(dict)``. + Determine whether an item is in the given collection, in the sense that it is ``==`` to one of the values generated by iterating over the collection. Some collections need a slightly different definition; for example :obj:`Set`\ s check whether the item :func:`isequal` to one of the elements. :obj:`Dict`\ s look for ``(key,value)`` pairs, and the key is compared using :func:`isequal`\ . To test for the presence of a key in a dictionary, use :func:`haskey` or ``k in keys(dict)``\ . .. function:: eltype(type) @@ -213,7 +207,7 @@ Iterable Collections .. Docstring generated from Julia source - Returns the indices of elements in collection ``a`` that appear in collection ``b`` + Returns the indices of elements in collection ``a`` that appear in collection ``b``\ . .. function:: unique(itr[, dim]) @@ -249,31 +243,25 @@ Iterable Collections .. Docstring generated from Julia source - Like :func:`reduce`, but with guaranteed left associativity. ``v0`` - will be used exactly once. + Like :func:`reduce`\ , but with guaranteed left associativity. ``v0`` will be used exactly once. .. function:: foldl(op, itr) .. Docstring generated from Julia source - Like ``foldl(op, v0, itr)``, but using the first element of ``itr`` - as ``v0``. In general, this cannot be used with empty collections - (see ``reduce(op, itr)``). + Like ``foldl(op, v0, itr)``\ , but using the first element of ``itr`` as ``v0``\ . In general, this cannot be used with empty collections (see ``reduce(op, itr)``\ ). .. function:: foldr(op, v0, itr) .. Docstring generated from Julia source - Like :func:`reduce`, but with guaranteed right associativity. ``v0`` - will be used exactly once. + Like :func:`reduce`\ , but with guaranteed right associativity. ``v0`` will be used exactly once. .. function:: foldr(op, itr) .. Docstring generated from Julia source - Like ``foldr(op, v0, itr)``, but using the last element of ``itr`` - as ``v0``. In general, this cannot be used with empty collections - (see ``reduce(op, itr)``). + Like ``foldr(op, v0, itr)``\ , but using the last element of ``itr`` as ``v0``\ . In general, this cannot be used with empty collections (see ``reduce(op, itr)``\ ). .. function:: maximum(itr) @@ -568,93 +556,70 @@ Iterable Collections .. Docstring generated from Julia source - In-place version of :func:`map`. + In-place version of :func:`map`\ . .. function:: map!(function, destination, collection...) .. Docstring generated from Julia source - Like :func:`map`, but stores the result in ``destination`` rather than a - new collection. ``destination`` must be at least as large as the first - collection. + Like :func:`map`\ , but stores the result in ``destination`` rather than a new collection. ``destination`` must be at least as large as the first collection. .. function:: mapreduce(f, op, v0, itr) .. Docstring generated from Julia source - Apply function ``f`` to each element in ``itr``, and then reduce - the result using the binary function ``op``. ``v0`` must be a - neutral element for ``op`` that will be returned for empty - collections. It is unspecified whether ``v0`` is used for non-empty - collections. + Apply function ``f`` to each element in ``itr``\ , and then reduce the result using the binary function ``op``\ . ``v0`` must be a neutral element for ``op`` that will be returned for empty collections. It is unspecified whether ``v0`` is used for non-empty collections. - :func:`mapreduce` is functionally equivalent to calling ``reduce(op, - v0, map(f, itr))``, but will in general execute faster since no - intermediate collection needs to be created. See documentation for - :func:`reduce` and :func:`map`. + :func:`mapreduce` is functionally equivalent to calling ``reduce(op, v0, map(f, itr))``\ , but will in general execute faster since no intermediate collection needs to be created. See documentation for :func:`reduce` and :func:`map`\ . .. doctest:: - julia> mapreduce(x->x^2, +, [1:3;]) # == 1 + 4 + 9 - 14 + julia> mapreduce(x->x^2, +, [1:3;]) # == 1 + 4 + 9 + 14 - The associativity of the reduction is implementation-dependent. - Additionally, some implementations may reuse the return value of - ``f`` for elements that appear multiple times in ``itr``. - Use :func:`mapfoldl` or :func:`mapfoldr` instead for guaranteed - left or right associativity and invocation of ``f`` for every value. + The associativity of the reduction is implementation-dependent. Additionally, some implementations may reuse the return value of ``f`` for elements that appear multiple times in ``itr``\ . Use :func:`mapfoldl` or :func:`mapfoldr` instead for guaranteed left or right associativity and invocation of ``f`` for every value. .. function:: mapreduce(f, op, itr) .. Docstring generated from Julia source - Like ``mapreduce(f, op, v0, itr)``. In general, this cannot be used - with empty collections (see ``reduce(op, itr)``). + Like ``mapreduce(f, op, v0, itr)``\ . In general, this cannot be used with empty collections (see ``reduce(op, itr)``\ ). .. function:: mapfoldl(f, op, v0, itr) .. Docstring generated from Julia source - Like :func:`mapreduce`, but with guaranteed left associativity. ``v0`` - will be used exactly once. + Like :func:`mapreduce`\ , but with guaranteed left associativity. ``v0`` will be used exactly once. .. function:: mapfoldl(f, op, itr) .. Docstring generated from Julia source - Like ``mapfoldl(f, op, v0, itr)``, but using the first element of - ``itr`` as ``v0``. In general, this cannot be used with empty - collections (see ``reduce(op, itr)``). + Like ``mapfoldl(f, op, v0, itr)``\ , but using the first element of ``itr`` as ``v0``\ . In general, this cannot be used with empty collections (see ``reduce(op, itr)``\ ). .. function:: mapfoldr(f, op, v0, itr) .. Docstring generated from Julia source - Like :func:`mapreduce`, but with guaranteed right associativity. ``v0`` - will be used exactly once. + Like :func:`mapreduce`\ , but with guaranteed right associativity. ``v0`` will be used exactly once. .. function:: mapfoldr(f, op, itr) .. Docstring generated from Julia source - Like ``mapfoldr(f, op, v0, itr)``, but using the first element of - ``itr`` as ``v0``. In general, this cannot be used with empty - collections (see ``reduce(op, itr)``). + Like ``mapfoldr(f, op, v0, itr)``\ , but using the first element of ``itr`` as ``v0``\ . In general, this cannot be used with empty collections (see ``reduce(op, itr)``\ ). .. function:: first(coll) .. Docstring generated from Julia source - Get the first element of an iterable collection. Returns the start point of a :obj:`Range` - even if it is empty. + Get the first element of an iterable collection. Returns the start point of a :obj:`Range` even if it is empty. .. function:: last(coll) .. Docstring generated from Julia source - Get the last element of an ordered collection, if it can be computed in O(1) time. - This is accomplished by calling :func:`endof` to get the last index. - Returns the end point of a :obj:`Range` even if it is empty. + Get the last element of an ordered collection, if it can be computed in O(1) time. This is accomplished by calling :func:`endof` to get the last index. Returns the end point of a :obj:`Range` even if it is empty. .. function:: step(r) @@ -681,7 +646,7 @@ Iterable Collections .. Docstring generated from Julia source - Determine whether every element of ``a`` is also in ``b``, using :func:`in`. + Determine whether every element of ``a`` is also in ``b``\ , using :func:`in`\ . .. function:: filter(function, collection) @@ -702,9 +667,7 @@ Indexable Collections .. Docstring generated from Julia source - Retrieve the value(s) stored at the given key or index within a collection. - The syntax ``a[i,j,...]`` is converted by the compiler to - ``getindex(a, i, j, ...)``. + Retrieve the value(s) stored at the given key or index within a collection. The syntax ``a[i,j,...]`` is converted by the compiler to ``getindex(a, i, j, ...)``\ . .. function:: setindex!(collection, value, key...) @@ -751,26 +714,25 @@ Given a dictionary ``D``, the syntax ``D[x]`` returns the value of key ``x`` (if .. Docstring generated from Julia source - ``Dict{K,V}()`` constructs a hash table with keys of type ``K`` and values of type ``V``. + ``Dict{K,V}()`` constructs a hash table with keys of type ``K`` and values of type ``V``\ . - Given a single iterable argument, constructs a :obj:`Dict` whose key-value pairs - are taken from 2-tuples ``(key,value)`` generated by the argument. + Given a single iterable argument, constructs a :obj:`Dict` whose key-value pairs are taken from 2-tuples ``(key,value)`` generated by the argument. .. doctest:: - julia> Dict([("A", 1), ("B", 2)]) - Dict{ASCIIString,Int64} with 2 entries: - "B" => 2 - "A" => 1 + julia> Dict([("A", 1), ("B", 2)]) + Dict{ASCIIString,Int64} with 2 entries: + "B" => 2 + "A" => 1 Alternatively, a sequence of pair arguments may be passed. .. doctest:: - julia> Dict("A"=>1, "B"=>2) - Dict{ASCIIString,Int64} with 2 entries: - "B" => 2 - "A" => 1 + julia> Dict("A"=>1, "B"=>2) + Dict{ASCIIString,Int64} with 2 entries: + "B" => 2 + "A" => 1 .. function:: haskey(collection, key) -> Bool @@ -788,14 +750,16 @@ Given a dictionary ``D``, the syntax ``D[x]`` returns the value of key ``x`` (if .. Docstring generated from Julia source - Return the value stored for the given key, or if no mapping for the key is present, return ``f()``. Use :func:`get!` to also store the default value in the dictionary. + Return the value stored for the given key, or if no mapping for the key is present, return ``f()``\ . Use :func:`get!` to also store the default value in the dictionary. - This is intended to be called using ``do`` block syntax:: + This is intended to be called using ``do`` block syntax - get(dict, key) do - # default value calculated here - time() - end + .. code-block:: julia + + get(dict, key) do + # default value calculated here + time() + end .. function:: get!(collection, key, default) @@ -882,7 +846,7 @@ Given a dictionary ``D``, the syntax ``D[x]`` returns the value of key ``x`` (if .. Docstring generated from Julia source - Update collection with pairs from the other collections + Update collection with pairs from the other collections. .. function:: sizehint!(s, n) @@ -923,18 +887,13 @@ Set-Like Collections .. Docstring generated from Julia source - Construct a :obj:`Set` of the values generated by the given iterable object, or an empty set. - Should be used instead of :obj:`IntSet` for sparse integer sets, or for sets of arbitrary objects. + Construct a :obj:`Set` of the values generated by the given iterable object, or an empty set. Should be used instead of :obj:`IntSet` for sparse integer sets, or for sets of arbitrary objects. .. function:: IntSet([itr]) .. Docstring generated from Julia source - Construct a sorted set of positive ``Int``\ s generated by the given iterable - object, or an empty set. Implemented as a bit string, and therefore designed - for dense integer sets. Only ``Int``\ s greater than 0 can be stored. If the - set will be sparse (for example holding a few very large integers), use - :obj:`Set` instead. + Construct a sorted set of positive ``Int``\ s generated by the given iterable object, or an empty set. Implemented as a bit string, and therefore designed for dense integer sets. Only ``Int``\ s greater than 0 can be stored. If the set will be sparse (for example holding a few very large integers), use :obj:`Set` instead. .. function:: union(s1,s2...) ∪(s1,s2...) @@ -996,7 +955,7 @@ Set-Like Collections .. Docstring generated from Julia source - Returns the set-complement of :obj:`IntSet` ``s``. + Returns the set-complement of :obj:`IntSet` ``s``\ . .. function:: complement!(s) @@ -1015,7 +974,7 @@ Set-Like Collections .. Docstring generated from Julia source - Return ``true`` if ``A`` is a subset of or equal to ``S``. + Return ``true`` if ``A`` is a subset of or equal to ``S``\ . Fully implemented by: @@ -1033,23 +992,20 @@ Dequeues .. Docstring generated from Julia source - Insert one or more ``items`` at the end of ``collection``. + Insert one or more ``items`` at the end of ``collection``\ . .. doctest:: - julia> push!([1, 2, 3], 4, 5, 6) - 6-element Array{Int64,1}: - 1 - 2 - 3 - 4 - 5 - 6 + julia> push!([1, 2, 3], 4, 5, 6) + 6-element Array{Int64,1}: + 1 + 2 + 3 + 4 + 5 + 6 - Use :func:`append!` to add all the elements of another collection to - ``collection``. - The result of the preceding example is equivalent to - ``append!([1, 2, 3], [4, 5, 6])``. + Use :func:`append!` to add all the elements of another collection to ``collection``\ . The result of the preceding example is equivalent to ``append!([1, 2, 3], [4, 5, 6])``\ . .. function:: pop!(collection) -> item @@ -1275,31 +1231,28 @@ Dequeues .. Docstring generated from Julia source - Add the elements of ``collection2`` to the end of ``collection``. + Add the elements of ``collection2`` to the end of ``collection``\ . .. doctest:: - julia> append!([1],[2,3]) - 3-element Array{Int64,1}: - 1 - 2 - 3 + julia> append!([1],[2,3]) + 3-element Array{Int64,1}: + 1 + 2 + 3 .. doctest:: - julia> append!([1, 2, 3], [4, 5, 6]) - 6-element Array{Int64,1}: - 1 - 2 - 3 - 4 - 5 - 6 + julia> append!([1, 2, 3], [4, 5, 6]) + 6-element Array{Int64,1}: + 1 + 2 + 3 + 4 + 5 + 6 - Use :func:`push!` to add individual items to ``collection`` which are not - already themselves in another collection. - The result is of the preceding example is equivalent to - ``push!([1, 2, 3], 4, 5, 6)``. + Use :func:`push!` to add individual items to ``collection`` which are not already themselves in another collection. The result is of the preceding example is equivalent to ``push!([1, 2, 3], 4, 5, 6)``\ . .. function:: prepend!(collection, items) -> collection diff --git a/doc/stdlib/dates.rst b/doc/stdlib/dates.rst index 6a01349afb0dd..c6f4fc95b9f64 100644 --- a/doc/stdlib/dates.rst +++ b/doc/stdlib/dates.rst @@ -51,58 +51,61 @@ Alternatively, you can write ``using Base.Dates`` to bring all exported function .. Docstring generated from Julia source - Construct a ``DateTime`` type by parts. Arguments must be convertible to ``Int64``. + Construct a ``DateTime`` type by parts. Arguments must be convertible to ``Int64``\ . .. function:: DateTime(periods::Period...) -> DateTime .. Docstring generated from Julia source - Constuct a ``DateTime`` type by ``Period`` type parts. Arguments may be in any order. - DateTime parts not provided will default to the value of ``Dates.default(period)``. + Constuct a ``DateTime`` type by ``Period`` type parts. Arguments may be in any order. DateTime parts not provided will default to the value of ``Dates.default(period)``\ . .. function:: DateTime(f::Function, y[, m, d, h, mi, s]; step=Day(1), negate=false, limit=10000) -> DateTime .. Docstring generated from Julia source - Create a ``DateTime`` through the adjuster API. The starting point will be constructed from the - provided ``y, m, d...`` arguments, and will be adjusted until ``f::Function`` returns ``true``. The step size in - adjusting can be provided manually through the ``step`` keyword. If ``negate=true``, then the adjusting - will stop when ``f::Function`` returns ``false`` instead of ``true``. ``limit`` provides a limit to - the max number of iterations the adjustment API will pursue before throwing an error (in the case that ``f::Function`` is never satisfied). + Create a ``DateTime`` through the adjuster API. The starting point will be constructed from the provided ``y, m, d...`` arguments, and will be adjusted until ``f::Function`` returns ``true``\ . The step size in adjusting can be provided manually through the ``step`` keyword. If ``negate=true``\ , then the adjusting will stop when ``f::Function`` returns ``false`` instead of ``true``\ . ``limit`` provides a limit to the max number of iterations the adjustment API will pursue before throwing an error (in the case that ``f::Function`` is never satisfied). .. function:: DateTime(dt::Date) -> DateTime .. Docstring generated from Julia source - Converts a ``Date`` type to a ``DateTime``. - The hour, minute, second, and millisecond parts of the new ``DateTime`` are assumed to be zero. + Converts a ``Date`` type to a ``DateTime``\ . The hour, minute, second, and millisecond parts of the new ``DateTime`` are assumed to be zero. .. function:: DateTime(dt::AbstractString, format::AbstractString; locale="english") -> DateTime .. Docstring generated from Julia source - Construct a ``DateTime`` type by parsing the ``dt`` date string following the pattern given in - the ``format`` string. The following codes can be used for constructing format strings: - - =============== ========= =============================================================== - Code Matches Comment - =============== ========= =============================================================== - ``y`` 1996, 96 Returns year of 1996, 0096 - ``m`` 1, 01 Matches 1 or 2-digit months - ``u`` Jan Matches abbreviated months according to the ``locale`` keyword - ``U`` January Matches full month names according to the ``locale`` keyword - ``d`` 1, 01 Matches 1 or 2-digit days - ``H`` 00 Matches hours - ``M`` 00 Matches minutes - ``S`` 00 Matches seconds - ``s`` .500 Matches milliseconds - ``e`` Mon, Tues Matches abbreviated days of the week - ``E`` Monday Matches full name days of the week - ``yyyymmdd`` 19960101 Matches fixed-width year, month, and day - =============== ========= =============================================================== - - All characters not listed above are treated as delimiters between date and time slots. - So a ``dt`` string of "1996-01-15T00:00:00.0" would have a ``format`` string like "y-m-dTH:M:S.s". + Construct a ``DateTime`` type by parsing the ``dt`` date string following the pattern given in the ``format`` string. The following codes can be used for constructing format strings: + + +--------------+-----------+----------------------------------------------------------------+ + | Code | Matches | Comment | + +==============+===========+================================================================+ + | ``y`` | 1996, 96 | Returns year of 1996, 0096 | + +--------------+-----------+----------------------------------------------------------------+ + | ``m`` | 1, 01 | Matches 1 or 2-digit months | + +--------------+-----------+----------------------------------------------------------------+ + | ``u`` | Jan | Matches abbreviated months according to the ``locale`` keyword | + +--------------+-----------+----------------------------------------------------------------+ + | ``U`` | January | Matches full month names according to the ``locale`` keyword | + +--------------+-----------+----------------------------------------------------------------+ + | ``d`` | 1, 01 | Matches 1 or 2-digit days | + +--------------+-----------+----------------------------------------------------------------+ + | ``H`` | 00 | Matches hours | + +--------------+-----------+----------------------------------------------------------------+ + | ``M`` | 00 | Matches minutes | + +--------------+-----------+----------------------------------------------------------------+ + | ``S`` | 00 | Matches seconds | + +--------------+-----------+----------------------------------------------------------------+ + | ``s`` | .500 | Matches milliseconds | + +--------------+-----------+----------------------------------------------------------------+ + | ``e`` | Mon, Tues | Matches abbreviated days of the week | + +--------------+-----------+----------------------------------------------------------------+ + | ``E`` | Monday | Matches full name days of the week | + +--------------+-----------+----------------------------------------------------------------+ + | ``yyyymmdd`` | 19960101 | Matches fixed-width year, month, and day | + +--------------+-----------+----------------------------------------------------------------+ + + All characters not listed above are treated as delimiters between date and time slots. So a ``dt`` string of "1996-01-15T00:00:00.0" would have a ``format`` string like "y-m-dTH:M:S.s". .. function:: Dates.DateFormat(format::AbstractString) -> DateFormat @@ -114,7 +117,7 @@ Alternatively, you can write ``using Base.Dates`` to bring all exported function .. Docstring generated from Julia source - Similar form as above for parsing a ``DateTime``, but passes a ``DateFormat`` object instead of a raw formatting string. It is more efficient if similarly formatted date strings will be parsed repeatedly to first create a ``DateFormat`` object then use this method for parsing. + Similar form as above for parsing a ``DateTime``\ , but passes a ``DateFormat`` object instead of a raw formatting string. It is more efficient if similarly formatted date strings will be parsed repeatedly to first create a ``DateFormat`` object then use this method for parsing. .. function:: Date(y, [m, d]) -> Date @@ -306,8 +309,7 @@ Adjuster Functions .. Docstring generated from Julia source - Truncates the value of ``dt`` according to the provided ``Period`` type. - E.g. if ``dt`` is ``1996-01-01T12:30:00``, then ``trunc(dt,Day) == 1996-01-01T00:00:00``. + Truncates the value of ``dt`` according to the provided ``Period`` type. E.g. if ``dt`` is ``1996-01-01T12:30:00``\ , then ``trunc(dt,Day) == 1996-01-01T00:00:00``\ . .. function:: firstdayofweek(dt::TimeType) -> TimeType @@ -434,8 +436,7 @@ Conversion Functions .. Docstring generated from Julia source - Takes the number of seconds since unix epoch ``1970-01-01T00:00:00`` - and converts to the corresponding ``DateTime``. + Takes the number of seconds since unix epoch ``1970-01-01T00:00:00`` and converts to the corresponding ``DateTime``\ . .. function:: datetime2unix(dt::DateTime) -> Float64 @@ -447,8 +448,7 @@ Conversion Functions .. Docstring generated from Julia source - Takes the number of Julian calendar days since epoch - ``-4713-11-24T12:00:00`` and returns the corresponding ``DateTime``. + Takes the number of Julian calendar days since epoch ``-4713-11-24T12:00:00`` and returns the corresponding ``DateTime``\ . .. function:: datetime2julian(dt::DateTime) -> Float64 @@ -460,8 +460,7 @@ Conversion Functions .. Docstring generated from Julia source - Takes the number of Rata Die days since epoch ``0000-12-31T00:00:00`` - and returns the corresponding ``DateTime``. + Takes the number of Rata Die days since epoch ``0000-12-31T00:00:00`` and returns the corresponding ``DateTime``\ . .. function:: datetime2rata(dt::TimeType) -> Int64 diff --git a/doc/stdlib/file.rst b/doc/stdlib/file.rst index c01a11ec87144..fb86800822797 100644 --- a/doc/stdlib/file.rst +++ b/doc/stdlib/file.rst @@ -87,20 +87,33 @@ Returns a structure whose fields contain information about the file. The fields of the structure are: - ========= ====================================================================== - size The size (in bytes) of the file - device ID of the device that contains the file - inode The inode number of the file - mode The protection mode of the file - nlink The number of hard links to the file - uid The user id of the owner of the file - gid The group id of the file owner - rdev If this file refers to a device, the ID of the device it refers to - blksize The file-system preferred block size for the file - blocks The number of such blocks allocated - mtime Unix timestamp of when the file was last modified - ctime Unix timestamp of when the file was created - ========= ====================================================================== + +---------+--------------------------------------------------------------------+ + | Name | Description | + +=========+====================================================================+ + | size | The size (in bytes) of the file | + +---------+--------------------------------------------------------------------+ + | device | ID of the device that contains the file | + +---------+--------------------------------------------------------------------+ + | inode | The inode number of the file | + +---------+--------------------------------------------------------------------+ + | mode | The protection mode of the file | + +---------+--------------------------------------------------------------------+ + | nlink | The number of hard links to the file | + +---------+--------------------------------------------------------------------+ + | uid | The user id of the owner of the file | + +---------+--------------------------------------------------------------------+ + | gid | The group id of the file owner | + +---------+--------------------------------------------------------------------+ + | rdev | If this file refers to a device, the ID of the device it refers to | + +---------+--------------------------------------------------------------------+ + | blksize | The file-system preferred block size for the file | + +---------+--------------------------------------------------------------------+ + | blocks | The number of such blocks allocated | + +---------+--------------------------------------------------------------------+ + | mtime | Unix timestamp of when the file was last modified | + +---------+--------------------------------------------------------------------+ + | ctime | Unix timestamp of when the file was created | + +---------+--------------------------------------------------------------------+ .. function:: lstat(file) @@ -118,7 +131,7 @@ .. Docstring generated from Julia source - Equivalent to ``stat(file).mtime`` + Equivalent to ``stat(file).mtime``\ . .. function:: filemode(file) @@ -130,7 +143,7 @@ .. Docstring generated from Julia source - Equivalent to ``stat(file).size`` + Equivalent to ``stat(file).size``\ . .. function:: uperm(file) @@ -138,19 +151,23 @@ Gets the permissions of the owner of the file as a bitfield of - ==== ===================== - 01 Execute Permission - 02 Write Permission - 04 Read Permission - ==== ===================== + +-------+--------------------+ + | Value | Description | + +=======+====================+ + | 01 | Execute Permission | + +-------+--------------------+ + | 02 | Write Permission | + +-------+--------------------+ + | 04 | Read Permission | + +-------+--------------------+ - For allowed arguments, see ``stat``. + For allowed arguments, see ``stat``\ . .. function:: gperm(file) .. Docstring generated from Julia source - Like uperm but gets the permissions of the group owning the file + Like uperm but gets the permissions of the group owning the file. .. function:: operm(file) diff --git a/doc/stdlib/io-network.rst b/doc/stdlib/io-network.rst index b0480b91f2cde..6e6d40c0835cc 100644 --- a/doc/stdlib/io-network.rst +++ b/doc/stdlib/io-network.rst @@ -29,37 +29,35 @@ General I/O .. Docstring generated from Julia source - Alternate syntax for open, where a string-based mode specifier is used instead of the five booleans. The values of ``mode`` correspond to those from ``fopen(3)`` or Perl ``open``, and are equivalent to setting the following boolean groups: - - ==== ================================= - r read - r+ read, write - w write, create, truncate - w+ read, write, create, truncate - a write, create, append - a+ read, write, create, append - ==== ================================= + Alternate syntax for open, where a string-based mode specifier is used instead of the five booleans. The values of ``mode`` correspond to those from ``fopen(3)`` or Perl ``open``\ , and are equivalent to setting the following boolean groups: + + +------+-------------------------------+ + | Mode | Description | + +======+===============================+ + | r | read | + +------+-------------------------------+ + | r+ | read, write | + +------+-------------------------------+ + | w | write, create, truncate | + +------+-------------------------------+ + | w+ | read, write, create, truncate | + +------+-------------------------------+ + | a | write, create, append | + +------+-------------------------------+ + | a+ | read, write, create, append | + +------+-------------------------------+ .. function:: open(command, mode::AbstractString="r", stdio=DevNull) .. Docstring generated from Julia source - Start running ``command`` asynchronously, and return a tuple - ``(stream,process)``. If ``mode`` is ``"r"``, then ``stream`` - reads from the process's standard output and ``stdio`` optionally - specifies the process's standard input stream. If ``mode`` is - ``"w"``, then ``stream`` writes to the process's standard input - and ``stdio`` optionally specifies the process's standard output - stream. + Start running ``command`` asynchronously, and return a tuple ``(stream,process)``\ . If ``mode`` is ``"r"``\ , then ``stream`` reads from the process's standard output and ``stdio`` optionally specifies the process's standard input stream. If ``mode`` is ``"w"``\ , then ``stream`` writes to the process's standard input and ``stdio`` optionally specifies the process's standard output stream. .. function:: open(f::Function, command, mode::AbstractString="r", stdio=DevNull) .. Docstring generated from Julia source - Similar to ``open(command, mode, stdio)``, but calls ``f(stream)`` - on the resulting read or write stream, then closes the stream - and waits for the process to complete. Returns the value returned - by ``f``. + Similar to ``open(command, mode, stdio)``\ , but calls ``f(stream)`` on the resulting read or write stream, then closes the stream and waits for the process to complete. Returns the value returned by ``f``\ . .. function:: open(f::Function, args...) @@ -85,7 +83,7 @@ General I/O .. Docstring generated from Julia source - Create a read-only IOBuffer on the data underlying the given string + Create a read-only IOBuffer on the data underlying the given string. .. function:: IOBuffer([data,],[readable,writable,[maxsize]]) @@ -97,7 +95,7 @@ General I/O .. Docstring generated from Julia source - Obtain the contents of an ``IOBuffer`` as an array, without copying. Afterwards, the IOBuffer is reset to its initial state. + Obtain the contents of an ``IOBuffer`` as an array, without copying. Afterwards, the ``IOBuffer`` is reset to its initial state. .. function:: takebuf_string(b::IOBuffer) @@ -204,28 +202,25 @@ General I/O .. Docstring generated from Julia source - Add a mark at the current position of stream ``s``. Returns the marked position. + Add a mark at the current position of stream ``s``\ . Returns the marked position. - See also :func:`unmark`, :func:`reset`, :func:`ismarked` + See also :func:`unmark`\ , :func:`reset`\ , :func:`ismarked`\ . .. function:: unmark(s) .. Docstring generated from Julia source - Remove a mark from stream ``s``. - Returns ``true`` if the stream was marked, ``false`` otherwise. + Remove a mark from stream ``s``\ . Returns ``true`` if the stream was marked, ``false`` otherwise. - See also :func:`mark`, :func:`reset`, :func:`ismarked` + See also :func:`mark`\ , :func:`reset`\ , :func:`ismarked`\ . .. function:: reset(s) .. Docstring generated from Julia source - Reset a stream ``s`` to a previously marked position, and remove the mark. - Returns the previously marked position. - Throws an error if the stream is not marked. + Reset a stream ``s`` to a previously marked position, and remove the mark. Returns the previously marked position. Throws an error if the stream is not marked. - See also :func:`mark`, :func:`unmark`, :func:`ismarked` + See also :func:`mark`\ , :func:`unmark`\ , :func:`ismarked`\ . .. function:: ismarked(s) @@ -233,7 +228,7 @@ General I/O Returns ``true`` if stream ``s`` is marked. - See also :func:`mark`, :func:`unmark`, :func:`reset` + See also :func:`mark`\ , :func:`unmark`\ , :func:`reset`\ . .. function:: eof(stream) -> Bool @@ -287,7 +282,7 @@ General I/O .. Docstring generated from Julia source - General unescaping of traditional C and Unicode escape sequences. Reverse of :func:`print_escaped`. + General unescaping of traditional C and Unicode escape sequences. Reverse of :func:`print_escaped`\ . .. function:: print_joined(io, items, delim, [last]) @@ -323,7 +318,7 @@ General I/O .. Docstring generated from Julia source - Like redirect_stdout, but for STDERR + Like ``redirect_stdout``\ , but for ``STDERR``\ . .. function:: redirect_stdin([stream]) @@ -341,7 +336,7 @@ General I/O .. Docstring generated from Julia source - Resize the file or buffer given by the first argument to exactly ``n`` bytes, filling previously unallocated space with '\\0' if the file or buffer is grown + Resize the file or buffer given by the first argument to exactly ``n`` bytes, filling previously unallocated space with '\\0' if the file or buffer is grown. .. function:: skipchars(stream, predicate; linecomment::Char) @@ -412,7 +407,7 @@ Text I/O .. Docstring generated from Julia source - Print (using :func:`print`) ``x`` followed by a newline. + Print (using :func:`print`\ ) ``x`` followed by a newline. .. function:: print_with_color(color::Symbol, [io], strings...) @@ -745,7 +740,7 @@ Memory-mapped I/O Create an ``IO``\ -like object for creating zeroed-out mmapped-memory that is not tied to a file for use in ``Mmap.mmap``\ . Used by ``SharedArray`` for creating shared memory arrays. .. function:: Mmap.mmap(io::Union{IOStream,AbstractString,Mmap.AnonymousMmap}[, type::Type{Array{T,N}}, dims, offset]; grow::Bool=true, shared::Bool=true) - Mmap.mmap(type::Type{Array{T,N}}, dims) + Mmap.mmap(type::Type{Array{T,N}}, dims) .. Docstring generated from Julia source @@ -755,48 +750,50 @@ Memory-mapped I/O ``dims`` is a tuple or single ``Integer`` specifying the size or length of the array. - The file is passed via the stream argument, either as an open ``IOStream`` or filename string. When you initialize the stream, use ``"r"`` for a "read-only" array, and ``"w+"`` to create a new array used to write values to disk. + The file is passed via the stream argument, either as an open ``IOStream`` or filename string. When you initialize the stream, use ``"r"`` for a "read-only" array, and ``"w+"`` to create a new array used to write values to disk. - If no ``type`` argument is specified, the default is ``Vector{UInt8}``. + If no ``type`` argument is specified, the default is ``Vector{UInt8}``\ . - Optionally, you can specify an offset (in bytes) if, for example, you want to skip over a header in the file. The default value for the offset is the current stream position for an ``IOStream``. + Optionally, you can specify an offset (in bytes) if, for example, you want to skip over a header in the file. The default value for the offset is the current stream position for an ``IOStream``\ . The ``grow`` keyword argument specifies whether the disk file should be grown to accommodate the requested size of array (if the total file size is < requested array size). Write privileges are required to grow the file. The ``shared`` keyword argument specifies whether the resulting ``Array`` and changes made to it will be visible to other processes mapping the same file. - For example, the following code:: + For example, the following code + + .. code-block:: julia - # Create a file for mmapping - # (you could alternatively use mmap to do this step, too) - A = rand(1:20, 5, 30) - s = open("/tmp/mmap.bin", "w+") - # We'll write the dimensions of the array as the first two Ints in the file - write(s, size(A,1)) - write(s, size(A,2)) - # Now write the data - write(s, A) - close(s) + # Create a file for mmapping + # (you could alternatively use mmap to do this step, too) + A = rand(1:20, 5, 30) + s = open("/tmp/mmap.bin", "w+") + # We'll write the dimensions of the array as the first two Ints in the file + write(s, size(A,1)) + write(s, size(A,2)) + # Now write the data + write(s, A) + close(s) - # Test by reading it back in - s = open("/tmp/mmap.bin") # default is read-only - m = read(s, Int) - n = read(s, Int) - A2 = Mmap.mmap(s, Matrix{Int}, (m,n)) + # Test by reading it back in + s = open("/tmp/mmap.bin") # default is read-only + m = read(s, Int) + n = read(s, Int) + A2 = Mmap.mmap(s, Matrix{Int}, (m,n)) - creates a ``m``-by-``n`` ``Matrix{Int}``, linked to the file associated with stream ``s``. + creates a ``m``\ -by-``n`` ``Matrix{Int}``\ , linked to the file associated with stream ``s``\ . - A more portable file would need to encode the word size---32 bit or 64 bit---and endianness information in the header. In practice, consider encoding binary data using standard formats like HDF5 (which can be used with memory-mapping). + A more portable file would need to encode the word size – 32 bit or 64 bit – and endianness information in the header. In practice, consider encoding binary data using standard formats like HDF5 (which can be used with memory-mapping). .. function:: Mmap.mmap(io, BitArray, [dims, offset]) .. Docstring generated from Julia source - Create a ``BitArray`` whose values are linked to a file, using memory-mapping; it has the same purpose, works in the same way, and has the same arguments, as :func:`mmap`, but the byte representation is different. + Create a ``BitArray`` whose values are linked to a file, using memory-mapping; it has the same purpose, works in the same way, and has the same arguments, as :func:`mmap`\ , but the byte representation is different. - **Example**: ``B = Mmap.mmap(s, BitArray, (25,30000))`` + **Example**: ``B = Mmap.mmap(s, BitArray, (25,30000))`` - This would create a 25-by-30000 ``BitArray``, linked to the file associated with stream ``s``. + This would create a 25-by-30000 ``BitArray``\ , linked to the file associated with stream ``s``\ . .. function:: Mmap.sync!(array) @@ -811,13 +808,13 @@ Network I/O .. Docstring generated from Julia source - Connect to the host ``host`` on port ``port`` + Connect to the host ``host`` on port ``port``\ . .. function:: connect(path) -> PipeEndpoint .. Docstring generated from Julia source - Connect to the Named Pipe / Domain Socket at ``path`` + Connect to the Named Pipe / Domain Socket at ``path``\ . .. function:: listen([addr,]port) -> TCPServer @@ -829,7 +826,7 @@ Network I/O .. Docstring generated from Julia source - Create and listen on a Named Pipe / Domain Socket + Create and listen on a Named Pipe / Domain Socket. .. function:: getaddrinfo(host) @@ -853,7 +850,7 @@ Network I/O .. Docstring generated from Julia source - Returns IPv4 object from ip address formatted as Integer + Returns IPv4 object from ip address formatted as Integer. .. function:: IPv6(host::Integer) -> IPv6 diff --git a/doc/stdlib/libc.rst b/doc/stdlib/libc.rst index 4510a8baeafef..2da60ec943b7b 100644 --- a/doc/stdlib/libc.rst +++ b/doc/stdlib/libc.rst @@ -90,9 +90,9 @@ .. Docstring generated from Julia source - Forces synchronization of the :func:`mmap`\ ped memory region from ``ptr`` to ``ptr+len``. Flags defaults to ``MS_SYNC``, but can be a combination of ``MS_ASYNC``, ``MS_SYNC``, or ``MS_INVALIDATE``. See your platform man page for specifics. The flags argument is not valid on Windows. + Forces synchronization of the :func:`mmap`\ ped memory region from ``ptr`` to ``ptr+len``\ . Flags defaults to ``MS_SYNC``\ , but can be a combination of ``MS_ASYNC``\ , ``MS_SYNC``\ , or ``MS_INVALIDATE``\ . See your platform man page for specifics. The flags argument is not valid on Windows. - You may not need to call ``msync``, because synchronization is performed at intervals automatically by the operating system. However, you can call this directly if, for example, you are concerned about losing the result of a long-running calculation. + You may not need to call ``msync``\ , because synchronization is performed at intervals automatically by the operating system. However, you can call this directly if, for example, you are concerned about losing the result of a long-running calculation. .. data:: MS_ASYNC diff --git a/doc/stdlib/libdl.rst b/doc/stdlib/libdl.rst index aeb21d858d91b..f0de5bc935fe2 100644 --- a/doc/stdlib/libdl.rst +++ b/doc/stdlib/libdl.rst @@ -16,7 +16,7 @@ .. Docstring generated from Julia source - Similar to :func:`dlopen`, except returns a ``NULL`` pointer instead of raising errors. + Similar to :func:`dlopen`\ , except returns a ``NULL`` pointer instead of raising errors. .. data:: RTLD_DEEPBIND diff --git a/doc/stdlib/linalg.rst b/doc/stdlib/linalg.rst index b8b47afe96494..8223d2a3ed0bd 100644 --- a/doc/stdlib/linalg.rst +++ b/doc/stdlib/linalg.rst @@ -17,13 +17,13 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Matrix multiplication + Matrix multiplication. .. function:: \\(A, B) .. Docstring generated from Julia source - Matrix division using a polyalgorithm. For input matrices ``A`` and ``B``, the result ``X`` is such that ``A*X == B`` when ``A`` is square. The solver that is used depends upon the structure of ``A``. A direct solver is used for upper or lower triangular ``A``. For Hermitian ``A`` (equivalent to symmetric ``A`` for non-complex ``A``) the ``BunchKaufman`` factorization is used. Otherwise an LU factorization is used. For rectangular ``A`` the result is the minimum-norm least squares solution computed by a pivoted QR factorization of ``A`` and a rank estimate of ``A`` based on the R factor. + Matrix division using a polyalgorithm. For input matrices ``A`` and ``B``\ , the result ``X`` is such that ``A*X == B`` when ``A`` is square. The solver that is used depends upon the structure of ``A``\ . A direct solver is used for upper or lower triangular ``A``\ . For Hermitian ``A`` (equivalent to symmetric ``A`` for non-complex ``A``\ ) the ``BunchKaufman`` factorization is used. Otherwise an LU factorization is used. For rectangular ``A`` the result is the minimum-norm least squares solution computed by a pivoted QR factorization of ``A`` and a rank estimate of ``A`` based on the R factor. When ``A`` is sparse, a similar polyalgorithm is used. For indefinite matrices, the ``LDLt`` factorization does not use pivoting during the numerical factorization and therefore the procedure can fail even for invertible matrices. @@ -57,7 +57,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Reconstruct the matrix ``A`` from the factorization ``F=factorize(A)``. + Reconstruct the matrix ``A`` from the factorization ``F=factorize(A)``\ . .. function:: lu(A) -> L, U, p @@ -69,47 +69,61 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Compute the LU factorization of ``A``. The return type of ``F`` depends on the type of ``A``. In most cases, if ``A`` is a subtype ``S`` of AbstractMatrix with an element type ``T`` supporting ``+``, ``-``, ``*`` and ``/`` the return type is ``LU{T,S{T}}``. If pivoting is chosen (default) the element type should also support ``abs`` and ``<``. When ``A`` is sparse and have element of type ``Float32``, ``Float64``, ``Complex{Float32}``, or ``Complex{Float64}`` the return type is ``UmfpackLU``. Some examples are shown in the table below. + Compute the LU factorization of ``A``\ . The return type of ``F`` depends on the type of ``A``\ . In most cases, if ``A`` is a subtype ``S`` of AbstractMatrix with an element type ``T`` supporting ``+``\ , ``-``\ , ``*`` and ``/`` the return type is ``LU{T,S{T}}``\ . If pivoting is chosen (default) the element type should also support ``abs`` and ``<``\ . When ``A`` is sparse and have element of type ``Float32``\ , ``Float64``\ , ``Complex{Float32}``\ , or ``Complex{Float64}`` the return type is ``UmfpackLU``\ . Some examples are shown in the table below. - ======================= ========================= ======================================== - Type of input ``A`` Type of output ``F`` Relationship between ``F`` and ``A`` - ======================= ========================= ======================================== - :func:`Matrix` ``LU`` ``F[:L]*F[:U] == A[F[:p], :]`` - :func:`Tridiagonal` ``LU{T,Tridiagonal{T}}`` ``F[:L]*F[:U] == A[F[:p], :]`` - :func:`SparseMatrixCSC` ``UmfpackLU`` ``F[:L]*F[:U] == (F[:Rs] .* A)[F[:p], F[:q]]`` - ======================= ========================= ======================================== + +-------------------------+--------------------------+------------------------------------------------+ + | Type of input ``A`` | Type of output ``F`` | Relationship between ``F`` and ``A`` | + +=========================+==========================+================================================+ + | :func:`Matrix` | ``LU`` | ``F[:L]*F[:U] == A[F[:p], :]`` | + +-------------------------+--------------------------+------------------------------------------------+ + | :func:`Tridiagonal` | ``LU{T,Tridiagonal{T}}`` | ``F[:L]*F[:U] == A[F[:p], :]`` | + +-------------------------+--------------------------+------------------------------------------------+ + | :func:`SparseMatrixCSC` | ``UmfpackLU`` | ``F[:L]*F[:U] == (F[:Rs] .* A)[F[:p], F[:q]]`` | + +-------------------------+--------------------------+------------------------------------------------+ The individual components of the factorization ``F`` can be accessed by indexing: - =========== ======================================= ====== ======================== ============= - Component Description ``LU`` ``LU{T,Tridiagonal{T}}`` ``UmfpackLU`` - =========== ======================================= ====== ======================== ============= - ``F[:L]`` ``L`` (lower triangular) part of ``LU`` ✓ ✓ ✓ - ``F[:U]`` ``U`` (upper triangular) part of ``LU`` ✓ ✓ ✓ - ``F[:p]`` (right) permutation ``Vector`` ✓ ✓ ✓ - ``F[:P]`` (right) permutation ``Matrix`` ✓ ✓ - ``F[:q]`` left permutation ``Vector`` ✓ - ``F[:Rs]`` ``Vector`` of scaling factors ✓ - ``F[:(:)]`` ``(L,U,p,q,Rs)`` components ✓ - =========== ======================================= ====== ======================== ============= - - ================== ====== ======================== ============= - Supported function ``LU`` ``LU{T,Tridiagonal{T}}`` ``UmfpackLU`` - ================== ====== ======================== ============= - ``/`` ✓ - ``\`` ✓ ✓ ✓ - ``cond`` ✓ ✓ - ``det`` ✓ ✓ ✓ - ``logdet`` ✓ ✓ - ``logabsdet`` ✓ ✓ - ``size`` ✓ ✓ - ================== ====== ======================== ============= + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | Component | Description | ``LU`` | ``LU{T,Tridiagonal{T}}`` | ``UmfpackLU`` | + +=============+=========================================+========+==========================+===============+ + | ``F[:L]`` | ``L`` (lower triangular) part of ``LU`` | ✓ | ✓ | ✓ | + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | ``F[:U]`` | ``U`` (upper triangular) part of ``LU`` | ✓ | ✓ | ✓ | + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | ``F[:p]`` | (right) permutation ``Vector`` | ✓ | ✓ | ✓ | + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | ``F[:P]`` | (right) permutation ``Matrix`` | ✓ | ✓ | | + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | ``F[:q]`` | left permutation ``Vector`` | | | ✓ | + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | ``F[:Rs]`` | ``Vector`` of scaling factors | | | ✓ | + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | ``F[:(:)]`` | ``(L,U,p,q,Rs)`` components | | | ✓ | + +-------------+-----------------------------------------+--------+--------------------------+---------------+ + + +--------------------+--------+--------------------------+---------------+ + | Supported function | ``LU`` | ``LU{T,Tridiagonal{T}}`` | ``UmfpackLU`` | + +====================+========+==========================+===============+ + | ``/`` | ✓ | | | + +--------------------+--------+--------------------------+---------------+ + | ``\`` | ✓ | ✓ | ✓ | + +--------------------+--------+--------------------------+---------------+ + | ``cond`` | ✓ | | ✓ | + +--------------------+--------+--------------------------+---------------+ + | ``det`` | ✓ | ✓ | ✓ | + +--------------------+--------+--------------------------+---------------+ + | ``logdet`` | ✓ | ✓ | | + +--------------------+--------+--------------------------+---------------+ + | ``logabsdet`` | ✓ | ✓ | | + +--------------------+--------+--------------------------+---------------+ + | ``size`` | ✓ | ✓ | | + +--------------------+--------+--------------------------+---------------+ .. function:: lufact!(A) -> LU .. Docstring generated from Julia source - ``lufact!`` is the same as :func:`lufact`, but saves space by overwriting the input ``A``, instead of creating a copy. For sparse ``A`` the ``nzval`` field is not overwritten but the index fields, ``colptr`` and ``rowval`` are decremented in place, converting from 1-based indices to 0-based indices. + ``lufact!`` is the same as :func:`lufact`\ , but saves space by overwriting the input ``A``\ , instead of creating a copy. For sparse ``A`` the ``nzval`` field is not overwritten but the index fields, ``colptr`` and ``rowval`` are decremented in place, converting from 1-based indices to 0-based indices. .. function:: chol(A::AbstractMatrix) -> U @@ -143,7 +157,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - ``cholfact!`` is the same as :func:`cholfact`, but saves space by overwriting the input ``A``, instead of creating a copy. ``cholfact!`` can also reuse the symbolic factorization from a different matrix ``F`` with the same structure when used as: ``cholfact!(F::CholmodFactor, A)``. + ``cholfact!`` is the same as :func:`cholfact`\ , but saves space by overwriting the input ``A``\ , instead of creating a copy. ``cholfact!`` can also reuse the symbolic factorization from a different matrix ``F`` with the same structure when used as: ``cholfact!(F::CholmodFactor, A)``\ . .. currentmodule:: Base.LinAlg @@ -243,129 +257,120 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Computes the QR factorization of ``A``. The return type of ``F`` depends on the element type of ``A`` and whether pivoting is specified (with ``pivot==Val{true}``). + Computes the QR factorization of ``A``\ . The return type of ``F`` depends on the element type of ``A`` and whether pivoting is specified (with ``pivot==Val{true}``\ ). - ================ ================= ============== ===================================== - Return type ``eltype(A)`` ``pivot`` Relationship between ``F`` and ``A`` - ================ ================= ============== ===================================== - ``QR`` not ``BlasFloat`` either ``A==F[:Q]*F[:R]`` - ``QRCompactWY`` ``BlasFloat`` ``Val{false}`` ``A==F[:Q]*F[:R]`` - ``QRPivoted`` ``BlasFloat`` ``Val{true}`` ``A[:,F[:p]]==F[:Q]*F[:R]`` - ================ ================= ============== ===================================== + +-----------------+-------------------+----------------+--------------------------------------+ + | Return type | ``eltype(A)`` | ``pivot`` | Relationship between ``F`` and ``A`` | + +=================+===================+================+======================================+ + | ``QR`` | not ``BlasFloat`` | either | ``A==F[:Q]*F[:R]`` | + +-----------------+-------------------+----------------+--------------------------------------+ + | ``QRCompactWY`` | ``BlasFloat`` | ``Val{false}`` | ``A==F[:Q]*F[:R]`` | + +-----------------+-------------------+----------------+--------------------------------------+ + | ``QRPivoted`` | ``BlasFloat`` | ``Val{true}`` | ``A[:,F[:p]]==F[:Q]*F[:R]`` | + +-----------------+-------------------+----------------+--------------------------------------+ - ``BlasFloat`` refers to any of: ``Float32``, ``Float64``, ``Complex64`` or ``Complex128``. + ``BlasFloat`` refers to any of: ``Float32``\ , ``Float64``\ , ``Complex64`` or ``Complex128``\ . The individual components of the factorization ``F`` can be accessed by indexing: - =========== ============================================= ================== ===================== ================== - Component Description ``QR`` ``QRCompactWY`` ``QRPivoted`` - =========== ============================================= ================== ===================== ================== - ``F[:Q]`` ``Q`` (orthogonal/unitary) part of ``QR`` ✓ (``QRPackedQ``) ✓ (``QRCompactWYQ``) ✓ (``QRPackedQ``) - ``F[:R]`` ``R`` (upper right triangular) part of ``QR`` ✓ ✓ ✓ - ``F[:p]`` pivot ``Vector`` ✓ - ``F[:P]`` (pivot) permutation ``Matrix`` ✓ - =========== ============================================= ================== ===================== ================== + +-----------+-----------------------------------------------+---------------------+------------------------+---------------------+ + | Component | Description | ``QR`` | ``QRCompactWY`` | ``QRPivoted`` | + +===========+===============================================+=====================+========================+=====================+ + | ``F[:Q]`` | ``Q`` (orthogonal/unitary) part of ``QR`` | ✓ (``QRPackedQ``\ ) | ✓ (``QRCompactWYQ``\ ) | ✓ (``QRPackedQ``\ ) | + +-----------+-----------------------------------------------+---------------------+------------------------+---------------------+ + | ``F[:R]`` | ``R`` (upper right triangular) part of ``QR`` | ✓ | ✓ | ✓ | + +-----------+-----------------------------------------------+---------------------+------------------------+---------------------+ + | ``F[:p]`` | pivot ``Vector`` | | | ✓ | + +-----------+-----------------------------------------------+---------------------+------------------------+---------------------+ + | ``F[:P]`` | (pivot) permutation ``Matrix`` | | | ✓ | + +-----------+-----------------------------------------------+---------------------+------------------------+---------------------+ - The following functions are available for the ``QR`` objects: ``size``, ``\``. When ``A`` is rectangular, ``\`` will return a least squares solution and if the solution is not unique, the one with smallest norm is returned. + The following functions are available for the ``QR`` objects: ``size``\ , ``\``\ . When ``A`` is rectangular, ``\`` will return a least squares solution and if the solution is not unique, the one with smallest norm is returned. - Multiplication with respect to either thin or full ``Q`` is allowed, i.e. both ``F[:Q]*F[:R]`` and ``F[:Q]*A`` are supported. A ``Q`` matrix can be converted into a regular matrix with :func:`full` which has a named argument ``thin``. + Multiplication with respect to either thin or full ``Q`` is allowed, i.e. both ``F[:Q]*F[:R]`` and ``F[:Q]*A`` are supported. A ``Q`` matrix can be converted into a regular matrix with :func:`full` which has a named argument ``thin``\ . - .. note:: + **note** - ``qrfact`` returns multiple types because LAPACK uses several representations that minimize the memory storage requirements of products of Householder elementary reflectors, so that the ``Q`` and ``R`` matrices can be stored compactly rather as two separate dense matrices. + ``qrfact`` returns multiple types because LAPACK uses several representations that minimize the memory storage requirements of products of Householder elementary reflectors, so that the ``Q`` and ``R`` matrices can be stored compactly rather as two separate dense matrices. - The data contained in ``QR`` or ``QRPivoted`` can be used to construct the ``QRPackedQ`` type, which is a compact representation of the rotation matrix: + The data contained in ``QR`` or ``QRPivoted`` can be used to construct the ``QRPackedQ`` type, which is a compact representation of the rotation matrix: - .. math:: + .. math:: + + Q = \prod_{i=1}^{\min(m,n)} (I - \tau_i v_i v_i^T) - Q = \prod_{i=1}^{\min(m,n)} (I - \tau_i v_i v_i^T) + where :math:`\tau_i` is the scale factor and :math:`v_i` is the projection vector associated with the :math:`i^{th}` Householder elementary reflector. - where :math:`\tau_i` is the scale factor and :math:`v_i` is the projection vector associated with the :math:`i^{th}` Householder elementary reflector. + The data contained in ``QRCompactWY`` can be used to construct the ``QRCompactWYQ`` type, which is a compact representation of the rotation matrix - The data contained in ``QRCompactWY`` can be used to construct the ``QRCompactWYQ`` type, which is a compact representation of the rotation matrix + .. math:: - .. math:: + Q = I + Y T Y^T - Q = I + Y T Y^T + where ``Y`` is :math:`m \times r` lower trapezoidal and ``T`` is :math:`r \times r` upper triangular. The *compact WY* representation [Schreiber1989]_ is not to be confused with the older, *WY* representation [Bischof1987]_. (The LAPACK documentation uses ``V`` in lieu of ``Y``\ .) - where ``Y`` is :math:`m \times r` lower trapezoidal and ``T`` is :math:`r \times r` upper triangular. The *compact WY* representation [Schreiber1989]_ is not to be confused with the older, *WY* representation [Bischof1987]_. (The LAPACK documentation uses ``V`` in lieu of ``Y``.) + .. [Bischof1987] C Bischof and C Van Loan, "The WY representation for products of Householder matrices", SIAM J Sci Stat Comput 8 (1987), s2-s13. `doi:10.1137/0908009 `_ - .. [Bischof1987] C Bischof and C Van Loan, "The WY representation for products - of Householder matrices", SIAM J Sci Stat Comput 8 (1987), s2-s13. - `doi:10.1137/0908009 `_ - .. [Schreiber1989] R Schreiber and C Van Loan, "A storage-efficient WY - representation for products of Householder transformations", - SIAM J Sci Stat Comput 10 (1989), 53-57. - `doi:10.1137/0910005 `_ + .. [Schreiber1989] R Schreiber and C Van Loan, "A storage-efficient WY representation for products of Householder transformations", SIAM J Sci Stat Comput 10 (1989), 53-57. `doi:10.1137/0910005 `_ .. function:: qrfact(A) -> SPQR.Factorization .. Docstring generated from Julia source - Compute the QR factorization of a sparse matrix ``A``. A fill-reducing permutation is used. The main application of this type is to solve least squares problems with ``\``. The function calls the C library SPQR and a few additional functions from the library are wrapped but not exported. + Compute the QR factorization of a sparse matrix ``A``\ . A fill-reducing permutation is used. The main application of this type is to solve least squares problems with ``\``\ . The function calls the C library SPQR and a few additional functions from the library are wrapped but not exported. .. function:: qrfact!(A [,pivot=Val{false}]) .. Docstring generated from Julia source - ``qrfact!`` is the same as :func:`qrfact` when ``A`` is a subtype of ``StridedMatrix``, but saves space by overwriting the input ``A``, instead of creating a copy. + ``qrfact!`` is the same as :func:`qrfact` when ``A`` is a subtype of ``StridedMatrix``\ , but saves space by overwriting the input ``A``\ , instead of creating a copy. .. function:: full(QRCompactWYQ[, thin=true]) -> Matrix .. Docstring generated from Julia source - Converts an orthogonal or unitary matrix stored as a ``QRCompactWYQ`` - object, i.e. in the compact WY format [Bischof1987]_, to a dense matrix. + Converts an orthogonal or unitary matrix stored as a ``QRCompactWYQ`` object, i.e. in the compact WY format [Bischof1987]_, to a dense matrix. - Optionally takes a ``thin`` Boolean argument, which if ``true`` omits the - columns that span the rows of ``R`` in the QR factorization that are zero. - The resulting matrix is the ``Q`` in a thin QR factorization (sometimes - called the reduced QR factorization). If ``false``, returns a ``Q`` that - spans all rows of ``R`` in its corresponding QR factorization. + Optionally takes a ``thin`` Boolean argument, which if ``true`` omits the columns that span the rows of ``R`` in the QR factorization that are zero. The resulting matrix is the ``Q`` in a thin QR factorization (sometimes called the reduced QR factorization). If ``false``\ , returns a ``Q`` that spans all rows of ``R`` in its corresponding QR factorization. .. function:: bkfact(A) -> BunchKaufman .. Docstring generated from Julia source - Compute the Bunch-Kaufman [Bunch1977]_ factorization of a real symmetric or complex Hermitian matrix ``A`` and return a ``BunchKaufman`` object. The following functions are available for ``BunchKaufman`` objects: ``size``, ``\``, ``inv``, ``issym``, ``ishermitian``. + Compute the Bunch-Kaufman [Bunch1977]_ factorization of a real symmetric or complex Hermitian matrix ``A`` and return a ``BunchKaufman`` object. The following functions are available for ``BunchKaufman`` objects: ``size``\ , ``\``\ , ``inv``\ , ``issym``\ , ``ishermitian``\ . - .. [Bunch1977] J R Bunch and L Kaufman, Some stable methods for calculating inertia and solving symmetric linear systems, Mathematics of Computation 31:137 (1977), 163-179. `url `_. + .. [Bunch1977] J R Bunch and L Kaufman, Some stable methods for calculating inertia and solving symmetric linear systems, Mathematics of Computation 31:137 (1977), 163-179. `url `_\ . .. function:: bkfact!(A) -> BunchKaufman .. Docstring generated from Julia source - ``bkfact!`` is the same as :func:`bkfact`, but saves space by overwriting the input ``A``, instead of creating a copy. + ``bkfact!`` is the same as :func:`bkfact`\ , but saves space by overwriting the input ``A``\ , instead of creating a copy. .. function:: eig(A,[irange,][vl,][vu,][permute=true,][scale=true]) -> D, V .. Docstring generated from Julia source - Computes eigenvalues and eigenvectors of ``A``. See :func:`eigfact` for - details on the ``balance`` keyword argument. + Computes eigenvalues and eigenvectors of ``A``\ . See :func:`eigfact` for details on the ``balance`` keyword argument. .. doctest:: - julia> eig([1.0 0.0 0.0; 0.0 3.0 0.0; 0.0 0.0 18.0]) - ([1.0,3.0,18.0], - 3x3 Array{Float64,2}: - 1.0 0.0 0.0 - 0.0 1.0 0.0 - 0.0 0.0 1.0) + julia> eig([1.0 0.0 0.0; 0.0 3.0 0.0; 0.0 0.0 18.0]) + ([1.0,3.0,18.0], + 3x3 Array{Float64,2}: + 1.0 0.0 0.0 + 0.0 1.0 0.0 + 0.0 0.0 1.0) - ``eig`` is a wrapper around :func:`eigfact`, extracting all parts of the - factorization to a tuple; where possible, using :func:`eigfact` is - recommended. + ``eig`` is a wrapper around :func:`eigfact`\ , extracting all parts of the factorization to a tuple; where possible, using :func:`eigfact` is recommended. .. function:: eig(A, B) -> D, V .. Docstring generated from Julia source - Computes generalized eigenvalues and vectors of ``A`` with respect to ``B``. + Computes generalized eigenvalues and vectors of ``A`` with respect to ``B``\ . - ``eig`` is a wrapper around :func:`eigfact`, extracting all parts of the - factorization to a tuple; where possible, using :func:`eigfact` is - recommended. + ``eig`` is a wrapper around :func:`eigfact`\ , extracting all parts of the factorization to a tuple; where possible, using :func:`eigfact` is recommended. .. function:: eigvals(A,[irange,][vl,][vu]) -> values @@ -397,66 +402,45 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Returns a matrix ``M`` whose columns are the eigenvectors of ``A``. - (The ``k``\ th eigenvector can be obtained from the slice ``M[:, k]``.) - The ``permute`` and ``scale`` keywords are the same as for :func:`eigfact`. + Returns a matrix ``M`` whose columns are the eigenvectors of ``A``\ . (The ``k``\ th eigenvector can be obtained from the slice ``M[:, k]``\ .) The ``permute`` and ``scale`` keywords are the same as for :func:`eigfact`\ . - For :class:`SymTridiagonal` matrices, if the optional vector of eigenvalues - ``eigvals`` is specified, returns the specific corresponding eigenvectors. + For :class:`SymTridiagonal` matrices, if the optional vector of eigenvalues ``eigvals`` is specified, returns the specific corresponding eigenvectors. .. function:: eigfact(A,[irange,][vl,][vu,][permute=true,][scale=true]) -> Eigen .. Docstring generated from Julia source - Computes the eigenvalue decomposition of ``A``, returning an ``Eigen`` - factorization object ``F`` which contains the eigenvalues in ``F[:values]`` - and the eigenvectors in the columns of the matrix ``F[:vectors]``. - (The ``k``\ th eigenvector can be obtained from the slice ``F[:vectors][:, k]``.) + Computes the eigenvalue decomposition of ``A``\ , returning an ``Eigen`` factorization object ``F`` which contains the eigenvalues in ``F[:values]`` and the eigenvectors in the columns of the matrix ``F[:vectors]``\ . (The ``k``\ th eigenvector can be obtained from the slice ``F[:vectors][:, k]``\ .) - The following functions are available for ``Eigen`` objects: ``inv``, - ``det``. + The following functions are available for ``Eigen`` objects: ``inv``\ , ``det``\ . - If ``A`` is :class:`Symmetric`, :class:`Hermitian` or :class:`SymTridiagonal`, - it is possible to calculate only a subset of the eigenvalues by specifying - either a :class:`UnitRange` ``irange`` covering indices of the sorted - eigenvalues or a pair ``vl`` and ``vu`` for the lower and upper boundaries - of the eigenvalues. + If ``A`` is :class:`Symmetric`\ , :class:`Hermitian` or :class:`SymTridiagonal`\ , it is possible to calculate only a subset of the eigenvalues by specifying either a :class:`UnitRange` ``irange`` covering indices of the sorted eigenvalues or a pair ``vl`` and ``vu`` for the lower and upper boundaries of the eigenvalues. - For general nonsymmetric matrices it is possible to specify how the matrix - is balanced before the eigenvector calculation. The option ``permute=true`` - permutes the matrix to become closer to upper triangular, and ``scale=true`` - scales the matrix by its diagonal elements to make rows and columns more - equal in norm. The default is ``true`` for both options. + For general nonsymmetric matrices it is possible to specify how the matrix is balanced before the eigenvector calculation. The option ``permute=true`` permutes the matrix to become closer to upper triangular, and ``scale=true`` scales the matrix by its diagonal elements to make rows and columns more equal in norm. The default is ``true`` for both options. .. function:: eigfact(A, B) -> GeneralizedEigen .. Docstring generated from Julia source - Computes the generalized eigenvalue decomposition of ``A`` and ``B``, - returning a ``GeneralizedEigen`` factorization object ``F`` which contains - the generalized eigenvalues in ``F[:values]`` and the generalized - eigenvectors in the columns of the matrix ``F[:vectors]``. (The ``k``\ th - generalized eigenvector can be obtained from the slice ``F[:vectors][:, - k]``.) + Computes the generalized eigenvalue decomposition of ``A`` and ``B``\ , returning a ``GeneralizedEigen`` factorization object ``F`` which contains the generalized eigenvalues in ``F[:values]`` and the generalized eigenvectors in the columns of the matrix ``F[:vectors]``\ . (The ``k``\ th generalized eigenvector can be obtained from the slice ``F[:vectors][:, k]``\ .) .. function:: eigfact!(A, [B]) .. Docstring generated from Julia source - Same as :func:`eigfact`, but saves space by overwriting the input ``A`` (and - ``B``), instead of creating a copy. + Same as :func:`eigfact`\ , but saves space by overwriting the input ``A`` (and ``B``\ ), instead of creating a copy. .. function:: hessfact(A) .. Docstring generated from Julia source - Compute the Hessenberg decomposition of ``A`` and return a ``Hessenberg`` object. If ``F`` is the factorization object, the unitary matrix can be accessed with ``F[:Q]`` and the Hessenberg matrix with ``F[:H]``. When ``Q`` is extracted, the resulting type is the ``HessenbergQ`` object, and may be converted to a regular matrix with :func:`full`. + Compute the Hessenberg decomposition of ``A`` and return a ``Hessenberg`` object. If ``F`` is the factorization object, the unitary matrix can be accessed with ``F[:Q]`` and the Hessenberg matrix with ``F[:H]``\ . When ``Q`` is extracted, the resulting type is the ``HessenbergQ`` object, and may be converted to a regular matrix with :func:`full`\ . .. function:: hessfact!(A) .. Docstring generated from Julia source - ``hessfact!`` is the same as :func:`hessfact`, but saves space by overwriting the input ``A``, instead of creating a copy. + ``hessfact!`` is the same as :func:`hessfact`\ , but saves space by overwriting the input ``A``\ , instead of creating a copy. .. function:: schurfact(A::StridedMatrix) -> F::Schur @@ -476,7 +460,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f Computes the Schur factorization of the matrix ``A``\ . The methods return the (quasi) triangular Schur factor ``T`` and the orthogonal/unitary Schur vectors ``Z`` such that ``A = Z*T*Z'``\ . The eigenvalues of ``A`` are returned in the vector ``λ``\ . - See ``schurfact`` + See ``schurfact``\ . .. function:: ordschur(F::Schur, select::Union{Vector{Bool},BitVector}) -> F::Schur @@ -518,7 +502,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Reorders the Generalized Schur factorization ``F`` of a matrix pair ``(A, B) = (Q*S*Z', Q*T*Z')`` according to the logical array ``select`` and returns a GeneralizedSchur object ``F``\ . The selected eigenvalues appear in the leading diagonal of both ``F[:S]`` and ``F[:T]``\ , and the left and right orthogonal/unitary Schur vectors are also reordered such that ``(A, B) = F[:Q]*(F[:S], F[:T])*F[:Z]'`` still holds and the generalized eigenvalues of ``A`` and ``B`` can still be obtained with ``F[:alpha]./F[:beta]``\ . + Reorders the Generalized Schur factorization ``F`` of a matrix pair ``(A, B) = (Q*S*Z', Q*T*Z')`` according to the logical array ``select`` and returns a GeneralizedSchur object ``F``\ . The selected eigenvalues appear in the leading diagonal of both ``F[:S]`` and ``F[:T]``\ , and the left and right orthogonal/unitary Schur vectors are also reordered such that ``(A, B) = F[:Q]*(F[:S], F[:T])*F[:Z]'`` still holds and the generalized eigenvalues of ``A`` and ``B`` can still be obtained with ``F[:alpha]./F[:beta]``\ . .. function:: ordschur!(F::GeneralizedSchur, select::Union{Vector{Bool},BitVector}) -> F::GeneralizedSchur @@ -542,7 +526,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - See ``schurfact`` + See ``schurfact``\ . .. function:: svdfact(A, [thin=true]) -> SVD @@ -554,7 +538,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - ``svdfact!`` is the same as :func:`svdfact`, but saves space by overwriting the input ``A``, instead of creating a copy. If ``thin`` is ``true``, an economy mode decomposition is returned. The default is to produce a thin decomposition. + ``svdfact!`` is the same as :func:`svdfact`\ , but saves space by overwriting the input ``A``\ , instead of creating a copy. If ``thin`` is ``true``\ , an economy mode decomposition is returned. The default is to produce a thin decomposition. .. function:: svd(A, [thin=true]) -> U, S, V @@ -686,33 +670,27 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Scale an array ``A`` by a scalar ``b``, similar to :func:`scale` but - overwriting ``A`` in-place. + Scale an array ``A`` by a scalar ``b``\ , similar to :func:`scale` but overwriting ``A`` in-place. - If ``A`` is a matrix and ``b`` is a vector, then ``scale!(A,b)`` - scales each column ``i`` of ``A`` by ``b[i]`` (similar to - ``A*diagm(b)``), while ``scale!(b,A)`` scales each row ``i`` of - ``A`` by ``b[i]`` (similar to ``diagm(b)*A``), again operating in-place - on ``A``. + If ``A`` is a matrix and ``b`` is a vector, then ``scale!(A,b)`` scales each column ``i`` of ``A`` by ``b[i]`` (similar to ``A*diagm(b)``\ ), while ``scale!(b,A)`` scales each row ``i`` of ``A`` by ``b[i]`` (similar to ``diagm(b)*A``\ ), again operating in-place on ``A``\ . .. function:: Tridiagonal(dl, d, du) .. Docstring generated from Julia source - Construct a tridiagonal matrix from the lower diagonal, diagonal, and upper diagonal, respectively. The result is of type ``Tridiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`full`. + Construct a tridiagonal matrix from the lower diagonal, diagonal, and upper diagonal, respectively. The result is of type ``Tridiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`full`\ . .. function:: Bidiagonal(dv, ev, isupper) .. Docstring generated from Julia source - Constructs an upper (``isupper=true``) or lower (``isupper=false``) bidiagonal matrix - using the given diagonal (``dv``) and off-diagonal (``ev``) vectors. The result is of type ``Bidiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`full`. + Constructs an upper (``isupper=true``\ ) or lower (``isupper=false``\ ) bidiagonal matrix using the given diagonal (``dv``\ ) and off-diagonal (``ev``\ ) vectors. The result is of type ``Bidiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`full`\ . .. function:: SymTridiagonal(d, du) .. Docstring generated from Julia source - Construct a real symmetric tridiagonal matrix from the diagonal and upper diagonal, respectively. The result is of type ``SymTridiagonal`` and provides efficient specialized eigensolvers, but may be converted into a regular matrix with :func:`full`. + Construct a real symmetric tridiagonal matrix from the diagonal and upper diagonal, respectively. The result is of type ``SymTridiagonal`` and provides efficient specialized eigensolvers, but may be converted into a regular matrix with :func:`full`\ . .. function:: rank(M) @@ -724,11 +702,11 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Compute the ``p``-norm of a vector or the operator norm of a matrix ``A``, defaulting to the ``p=2``-norm. + Compute the ``p``\ -norm of a vector or the operator norm of a matrix ``A``\ , defaulting to the ``p=2``\ -norm. - For vectors, ``p`` can assume any numeric value (even though not all values produce a mathematically valid vector norm). In particular, ``norm(A, Inf)`` returns the largest value in ``abs(A)``, whereas ``norm(A, -Inf)`` returns the smallest. + For vectors, ``p`` can assume any numeric value (even though not all values produce a mathematically valid vector norm). In particular, ``norm(A, Inf)`` returns the largest value in ``abs(A)``\ , whereas ``norm(A, -Inf)`` returns the smallest. - For matrices, the matrix norm induced by the vector ``p``-norm is used, where valid values of ``p`` are ``1``, ``2``, or ``Inf``. (Note that for sparse matrices, ``p=2`` is currently not implemented.) Use :func:`vecnorm` to compute the Frobenius norm. + For matrices, the matrix norm induced by the vector ``p``\ -norm is used, where valid values of ``p`` are ``1``\ , ``2``\ , or ``Inf``\ . (Note that for sparse matrices, ``p=2`` is currently not implemented.) Use :func:`vecnorm` to compute the Frobenius norm. .. function:: vecnorm(A, [p]) @@ -799,13 +777,13 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Matrix trace + Matrix trace. .. function:: det(M) .. Docstring generated from Julia source - Matrix determinant + Matrix determinant. .. function:: logdet(M) @@ -823,7 +801,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Matrix inverse + Matrix inverse. .. function:: pinv(M[, tol]) @@ -831,32 +809,19 @@ Linear algebra functions in Julia are largely implemented by calling functions f Computes the Moore-Penrose pseudoinverse. - For matrices ``M`` with floating point elements, it is convenient to compute - the pseudoinverse by inverting only singular values above a given threshold, - ``tol``. + For matrices ``M`` with floating point elements, it is convenient to compute the pseudoinverse by inverting only singular values above a given threshold, ``tol``\ . - The optimal choice of ``tol`` varies both with the value of ``M`` - and the intended application of the pseudoinverse. The default value of - ``tol`` is ``eps(real(float(one(eltype(M)))))*maximum(size(A))``, - which is essentially machine epsilon for the real part of a matrix element - multiplied by the larger matrix dimension. - For inverting dense ill-conditioned matrices in a least-squares sense, - ``tol = sqrt(eps(real(float(one(eltype(M))))))`` is recommended. + The optimal choice of ``tol`` varies both with the value of ``M`` and the intended application of the pseudoinverse. The default value of ``tol`` is ``eps(real(float(one(eltype(M)))))*maximum(size(A))``\ , which is essentially machine epsilon for the real part of a matrix element multiplied by the larger matrix dimension. For inverting dense ill-conditioned matrices in a least-squares sense, ``tol = sqrt(eps(real(float(one(eltype(M))))))`` is recommended. For more information, see [issue8859]_, [B96]_, [S84]_, [KY88]_. .. [issue8859] Issue 8859, "Fix least squares", https://github.com/JuliaLang/julia/pull/8859 - .. [B96] Åke Björck, "Numerical Methods for Least Squares Problems", - SIAM Press, Philadelphia, 1996, "Other Titles in Applied Mathematics", Vol. 51. - `doi:10.1137/1.9781611971484 `_ - .. [S84] G. W. Stewart, "Rank Degeneracy", SIAM Journal on - Scientific and Statistical Computing, 5(2), 1984, 403-413. - `doi:10.1137/0905030 `_ - .. [KY88] Konstantinos Konstantinides and Kung Yao, "Statistical analysis - of effective singular values in matrix rank determination", IEEE - Transactions on Acoustics, Speech and Signal Processing, 36(5), 1988, - 757-763. - `doi:10.1109/29.1585 `_ + + .. [B96] Åke Björck, "Numerical Methods for Least Squares Problems", SIAM Press, Philadelphia, 1996, "Other Titles in Applied Mathematics", Vol. 51. `doi:10.1137/1.9781611971484 `_ + + .. [S84] G. W. Stewart, "Rank Degeneracy", SIAM Journal on Scientific and Statistical Computing, 5(2), 1984, 403-413. `doi:10.1137/0905030 `_ + + .. [KY88] Konstantinos Konstantinides and Kung Yao, "Statistical analysis of effective singular values in matrix rank determination", IEEE Transactions on Acoustics, Speech and Signal Processing, 36(5), 1988, 757-763. `doi:10.1109/29.1585 `_ .. function:: nullspace(M) @@ -915,48 +880,37 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Compute the matrix exponential of ``A``, defined by + Compute the matrix exponential of ``A``\ , defined by .. math:: - e^A = \sum_{n=0}^{\infty} \frac{A^n}{n!}. + e^A = \sum_{n=0}^{\infty} \frac{A^n}{n!}. - For symmetric or Hermitian ``A``, an eigendecomposition (:func:`eigfact`) is used, otherwise the scaling and squaring algorithm (see [H05]_) is chosen. + For symmetric or Hermitian ``A``\ , an eigendecomposition (:func:`eigfact`\ ) is used, otherwise the scaling and squaring algorithm (see [H05]_) is chosen. - .. [H05] Nicholas J. Higham, "The squaring and scaling method for the matrix - exponential revisited", SIAM Journal on Matrix Analysis and Applications, - 26(4), 2005, 1179-1193. - `doi:10.1137/090768539 `_ + .. [H05] Nicholas J. Higham, "The squaring and scaling method for the matrix exponential revisited", SIAM Journal on Matrix Analysis and Applications, 26(4), 2005, 1179-1193. `doi:10.1137/090768539 `_ .. function:: logm(A::StridedMatrix) .. Docstring generated from Julia source - If ``A`` has no negative real eigenvalue, compute the principal matrix logarithm of ``A``, i.e. the unique matrix :math:`X` such that :math:`e^X = A` and :math:`-\pi < Im(\lambda) < \pi` for all the eigenvalues :math:`\lambda` of :math:`X`. If ``A`` has nonpositive eigenvalues, a nonprincipal matrix function is returned whenever possible. + If ``A`` has no negative real eigenvalue, compute the principal matrix logarithm of ``A``\ , i.e. the unique matrix :math:`X` such that :math:`e^X = A` and :math:`-\pi < Im(\lambda) < \pi` for all the eigenvalues :math:`\lambda` of :math:`X`\ . If ``A`` has nonpositive eigenvalues, a nonprincipal matrix function is returned whenever possible. + + If ``A`` is symmetric or Hermitian, its eigendecomposition (:func:`eigfact`\ ) is used, if ``A`` is triangular an improved version of the inverse scaling and squaring method is employed (see [AH12]_ and [AHR13]_). For general matrices, the complex Schur form (:func:`schur`\ ) is computed and the triangular algorithm is used on the triangular factor. - If ``A`` is symmetric or Hermitian, its eigendecomposition (:func:`eigfact`) is used, if ``A`` is triangular an improved version of the inverse scaling and squaring method is employed (see [AH12]_ and [AHR13]_). For general matrices, the complex Schur form (:func:`schur`) is computed and the triangular algorithm is used on the triangular factor. + .. [AH12] Awad H. Al-Mohy and Nicholas J. Higham, "Improved inverse scaling and squaring algorithms for the matrix logarithm", SIAM Journal on Scientific Computing, 34(4), 2012, C153-C169. `doi:10.1137/110852553 `_ - .. [AH12] Awad H. Al-Mohy and Nicholas J. Higham, "Improved inverse scaling - and squaring algorithms for the matrix logarithm", SIAM Journal on - Scientific Computing, 34(4), 2012, C153-C169. - `doi:10.1137/110852553 `_ - .. [AHR13] Awad H. Al-Mohy, Nicholas J. Higham and Samuel D. Relton, - "Computing the Fréchet derivative of the matrix logarithm and estimating - the condition number", SIAM Journal on Scientific Computing, 35(4), 2013, - C394-C410. - `doi:10.1137/120885991 `_ + .. [AHR13] Awad H. Al-Mohy, Nicholas J. Higham and Samuel D. Relton, "Computing the Fréchet derivative of the matrix logarithm and estimating the condition number", SIAM Journal on Scientific Computing, 35(4), 2013, C394-C410. `doi:10.1137/120885991 `_ .. function:: sqrtm(A) .. Docstring generated from Julia source - If ``A`` has no negative real eigenvalues, compute the principal matrix square root of ``A``, that is the unique matrix :math:`X` with eigenvalues having positive real part such that :math:`X^2 = A`. Otherwise, a nonprincipal square root is returned. + If ``A`` has no negative real eigenvalues, compute the principal matrix square root of ``A``\ , that is the unique matrix :math:`X` with eigenvalues having positive real part such that :math:`X^2 = A`\ . Otherwise, a nonprincipal square root is returned. - If ``A`` is symmetric or Hermitian, its eigendecomposition (:func:`eigfact`) is used to compute the square root. Otherwise, the square root is determined by means of the Björck-Hammarling method, which computes the complex Schur form (:func:`schur`) and then the complex square root of the triangular factor. + If ``A`` is symmetric or Hermitian, its eigendecomposition (:func:`eigfact`\ ) is used to compute the square root. Otherwise, the square root is determined by means of the Björck-Hammarling method, which computes the complex Schur form (:func:`schur`\ ) and then the complex square root of the triangular factor. - .. [BH83] Åke Björck and Sven Hammarling, "A Schur method for the square root - of a matrix", Linear Algebra and its Applications, 52-53, 1983, 127-140. - `doi:10.1016/0024-3795(83)80010-X `_ + .. [BH83] Åke Björck and Sven Hammarling, "A Schur method for the square root of a matrix", Linear Algebra and its Applications, 52-53, 1983, 127-140. `doi:10.1016/0024-3795(83)80010-X `_ .. function:: lyap(A, C) @@ -1040,115 +994,130 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Computes eigenvalues ``d`` of ``A`` using Lanczos or Arnoldi iterations for - real symmetric or general nonsymmetric matrices respectively. + Computes eigenvalues ``d`` of ``A`` using Lanczos or Arnoldi iterations for real symmetric or general nonsymmetric matrices respectively. The following keyword arguments are supported: - * ``nev``: Number of eigenvalues - * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrix ``A``. The default is ``ncv = max(20,2*nev+1)``. - Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. - * ``which``: type of eigenvalues to compute. See the note below. - - ========= ====================================================================================================================== - ``which`` type of eigenvalues - ========= ====================================================================================================================== - ``:LM`` eigenvalues of largest magnitude (default) - ``:SM`` eigenvalues of smallest magnitude - ``:LR`` eigenvalues of largest real part - ``:SR`` eigenvalues of smallest real part - ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) - ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) - ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) - ========= ====================================================================================================================== - - * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) - * ``maxiter``: Maximum number of iterations (default = 300) - * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. - * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` - * ``v0``: starting vector from which to start the iterations - - ``eigs`` returns the ``nev`` requested eigenvalues in ``d``, the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``), the number of converged eigenvalues ``nconv``, the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``, as well as the final residual vector ``resid``. - - .. note:: The ``sigma`` and ``which`` keywords interact: the description of eigenvalues searched for by ``which`` do _not_ necessarily refer to the eigenvalues of ``A``, but rather the linear operator constructed by the specification of the iteration mode implied by ``sigma``. - - =============== ================================== ================================== - ``sigma`` iteration mode ``which`` refers to eigenvalues of - =============== ================================== ================================== - ``nothing`` ordinary (forward) :math:`A` - real or complex inverse with level shift ``sigma`` :math:`(A - \sigma I )^{-1}` - =============== ================================== ================================== + * ``nev``\ : Number of eigenvalues + * ``ncv``\ : Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrix ``A``\ . The default is ``ncv = max(20,2*nev+1)``\ . Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. + * ``which``\ : type of eigenvalues to compute. See the note below. + + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``which`` | type of eigenvalues | + +===========+=============================================================================================================================+ + | ``:LM`` | eigenvalues of largest magnitude (default) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:SM`` | eigenvalues of smallest magnitude | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:LR`` | eigenvalues of largest real part | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:SR`` | eigenvalues of smallest real part | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:LI`` | eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:SI`` | eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:BE`` | compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + + * ``tol``\ : tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``\ ) + * ``maxiter``\ : Maximum number of iterations (default = 300) + * ``sigma``\ : Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. + * ``ritzvec``\ : Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` + * ``v0``\ : starting vector from which to start the iterations + + ``eigs`` returns the ``nev`` requested eigenvalues in ``d``\ , the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``\ ), the number of converged eigenvalues ``nconv``\ , the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``\ , as well as the final residual vector ``resid``\ . + + **note** + + The ``sigma`` and ``which`` keywords interact: the description of eigenvalues searched for by ``which`` do _not_ necessarily refer to the eigenvalues of ``A``\ , but rather the linear operator constructed by the specification of the iteration mode implied by ``sigma``\ . + + +-----------------+------------------------------------+------------------------------------+ + | ``sigma`` | iteration mode | ``which`` refers to eigenvalues of | + +=================+====================================+====================================+ + | ``nothing`` | ordinary (forward) | :math:`A` | + +-----------------+------------------------------------+------------------------------------+ + | real or complex | inverse with level shift ``sigma`` | :math:`(A - \sigma I )^{-1}` | + +-----------------+------------------------------------+------------------------------------+ .. function:: eigs(A, B; nev=6, ncv=max(20,2*nev+1), which="LM", tol=0.0, maxiter=300, sigma=nothing, ritzvec=true, v0=zeros((0,))) -> (d,[v,],nconv,niter,nmult,resid) .. Docstring generated from Julia source - Computes generalized eigenvalues ``d`` of ``A`` and ``B`` using Lanczos or Arnoldi iterations for - real symmetric or general nonsymmetric matrices respectively. + Computes generalized eigenvalues ``d`` of ``A`` and ``B`` using Lanczos or Arnoldi iterations for real symmetric or general nonsymmetric matrices respectively. The following keyword arguments are supported: - * ``nev``: Number of eigenvalues - * ``ncv``: Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrices ``A`` and ``B``. The default is ``ncv = max(20,2*nev+1)``. - Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. - * ``which``: type of eigenvalues to compute. See the note below. - - ========= ====================================================================================================================== - ``which`` type of eigenvalues - ========= ====================================================================================================================== - ``:LM`` eigenvalues of largest magnitude (default) - ``:SM`` eigenvalues of smallest magnitude - ``:LR`` eigenvalues of largest real part - ``:SR`` eigenvalues of smallest real part - ``:LI`` eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) - ``:SI`` eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) - ``:BE`` compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) - ========= ====================================================================================================================== - - * ``tol``: tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``) - * ``maxiter``: Maximum number of iterations (default = 300) - * ``sigma``: Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. - * ``ritzvec``: Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` - * ``v0``: starting vector from which to start the iterations - - ``eigs`` returns the ``nev`` requested eigenvalues in ``d``, the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``), the number of converged eigenvalues ``nconv``, the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``, as well as the final residual vector ``resid``. - - .. note:: The ``sigma`` and ``which`` keywords interact: the description of eigenvalues searched for by ``which`` do _not_ necessarily refer to the eigenvalue problem :math:`Av = Bv\lambda`, but rather the linear operator constructed by the specification of the iteration mode implied by ``sigma``. - - =============== ================================== ================================== - ``sigma`` iteration mode ``which`` refers to the problem - =============== ================================== ================================== - ``nothing`` ordinary (forward) :math:`Av = Bv\lambda` - real or complex inverse with level shift ``sigma`` :math:`(A - \sigma B )^{-1}B = v\nu` - =============== ================================== ================================== + * ``nev``\ : Number of eigenvalues + * ``ncv``\ : Number of Krylov vectors used in the computation; should satisfy ``nev+1 <= ncv <= n`` for real symmetric problems and ``nev+2 <= ncv <= n`` for other problems, where ``n`` is the size of the input matrices ``A`` and ``B``\ . The default is ``ncv = max(20,2*nev+1)``\ . Note that these restrictions limit the input matrix ``A`` to be of dimension at least 2. + * ``which``\ : type of eigenvalues to compute. See the note below. + + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``which`` | type of eigenvalues | + +===========+=============================================================================================================================+ + | ``:LM`` | eigenvalues of largest magnitude (default) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:SM`` | eigenvalues of smallest magnitude | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:LR`` | eigenvalues of largest real part | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:SR`` | eigenvalues of smallest real part | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:LI`` | eigenvalues of largest imaginary part (nonsymmetric or complex ``A`` only) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:SI`` | eigenvalues of smallest imaginary part (nonsymmetric or complex ``A`` only) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + | ``:BE`` | compute half of the eigenvalues from each end of the spectrum, biased in favor of the high end. (real symmetric ``A`` only) | + +-----------+-----------------------------------------------------------------------------------------------------------------------------+ + + * ``tol``\ : tolerance (:math:`tol \le 0.0` defaults to ``DLAMCH('EPS')``\ ) + * ``maxiter``\ : Maximum number of iterations (default = 300) + * ``sigma``\ : Specifies the level shift used in inverse iteration. If ``nothing`` (default), defaults to ordinary (forward) iterations. Otherwise, find eigenvalues close to ``sigma`` using shift and invert iterations. + * ``ritzvec``\ : Returns the Ritz vectors ``v`` (eigenvectors) if ``true`` + * ``v0``\ : starting vector from which to start the iterations + + ``eigs`` returns the ``nev`` requested eigenvalues in ``d``\ , the corresponding Ritz vectors ``v`` (only if ``ritzvec=true``\ ), the number of converged eigenvalues ``nconv``\ , the number of iterations ``niter`` and the number of matrix vector multiplications ``nmult``\ , as well as the final residual vector ``resid``\ . + + **note** + + The ``sigma`` and ``which`` keywords interact: the description of eigenvalues searched for by ``which`` do _not_ necessarily refer to the eigenvalue problem :math:`Av = Bv\lambda`\ , but rather the linear operator constructed by the specification of the iteration mode implied by ``sigma``\ . + + +-----------------+------------------------------------+--------------------------------------+ + | ``sigma`` | iteration mode | ``which`` refers to the problem | + +=================+====================================+======================================+ + | ``nothing`` | ordinary (forward) | :math:`Av = Bv\lambda` | + +-----------------+------------------------------------+--------------------------------------+ + | real or complex | inverse with level shift ``sigma`` | :math:`(A - \sigma B )^{-1}B = v\nu` | + +-----------------+------------------------------------+--------------------------------------+ .. function:: svds(A; nsv=6, ritzvec=true, tol=0.0, maxiter=1000) -> (left_sv, s, right_sv, nconv, niter, nmult, resid) .. Docstring generated from Julia source - ``svds`` computes largest singular values ``s`` of ``A`` using Lanczos or Arnoldi iterations. - Uses :func:`eigs` underneath. + ``svds`` computes largest singular values ``s`` of ``A`` using Lanczos or Arnoldi iterations. Uses :func:`eigs` underneath. Inputs are: - * ``A``: Linear operator. It can either subtype of ``AbstractArray`` (e.g., sparse matrix) or duck typed. For duck typing ``A`` has to support ``size(A)``, ``eltype(A)``, ``A * vector`` and ``A' * vector``. - * ``nsv``: Number of singular values. - * ``ritzvec``: Whether to return the left and right singular vectors ``left_sv`` and ``right_sv``, default is ``true``. If ``false`` the singular vectors are omitted from the output. - * ``tol``: tolerance, see :func:`eigs`. - * ``maxiter``: Maximum number of iterations, see :func:`eigs`. + * ``A``\ : Linear operator. It can either subtype of ``AbstractArray`` (e.g., sparse matrix) or duck typed. For duck typing ``A`` has to support ``size(A)``\ , ``eltype(A)``\ , ``A * vector`` and ``A' * vector``\ . + * ``nsv``\ : Number of singular values. + * ``ritzvec``\ : Whether to return the left and right singular vectors ``left_sv`` and ``right_sv``\ , default is ``true``\ . If ``false`` the singular vectors are omitted from the output. + * ``tol``\ : tolerance, see :func:`eigs`\ . + * ``maxiter``\ : Maximum number of iterations, see :func:`eigs`\ . - **Example**:: + **Example** + + .. code-block:: julia - X = sprand(10, 5, 0.2) - svds(X, nsv = 2) + X = sprand(10, 5, 0.2) + svds(X, nsv = 2) .. function:: peakflops(n; parallel=false) .. Docstring generated from Julia source - ``peakflops`` computes the peak flop rate of the computer by using double precision :func:`Base.LinAlg.BLAS.gemm!`. By default, if no arguments are specified, it multiplies a matrix of size ``n x n``, where ``n = 2000``. If the underlying BLAS is using multiple threads, higher flop rates are realized. The number of BLAS threads can be set with ``blas_set_num_threads(n)``. + ``peakflops`` computes the peak flop rate of the computer by using double precision :func:`Base.LinAlg.BLAS.gemm!`\ . By default, if no arguments are specified, it multiplies a matrix of size ``n x n``\ , where ``n = 2000``\ . If the underlying BLAS is using multiple threads, higher flop rates are realized. The number of BLAS threads can be set with ``blas_set_num_threads(n)``\ . - If the keyword argument ``parallel`` is set to ``true``, ``peakflops`` is run in parallel on all the worker processors. The flop rate of the entire parallel computer is returned. When running in parallel, only 1 BLAS thread is used. The argument ``n`` still refers to the size of the problem that is solved on each processor. + If the keyword argument ``parallel`` is set to ``true``\ , ``peakflops`` is run in parallel on all the worker processors. The flop rate of the entire parallel computer is returned. When running in parallel, only 1 BLAS thread is used. The argument ``n`` still refers to the size of the problem that is solved on each processor. BLAS Functions -------------- @@ -1198,7 +1167,7 @@ Usually a function has 4 methods defined, one each for ``Float64``, .. Docstring generated from Julia source - sum of the absolute values of the first ``n`` elements of array ``X`` with stride ``incx``\ . + Sum of the absolute values of the first ``n`` elements of array ``X`` with stride ``incx``\ . .. function:: axpy!(a, X, Y) diff --git a/doc/stdlib/math.rst b/doc/stdlib/math.rst index b91f9b4ef5b82..c1d4e9edc87bb 100644 --- a/doc/stdlib/math.rst +++ b/doc/stdlib/math.rst @@ -48,8 +48,7 @@ Mathematical Operators .. Docstring generated from Julia source - Left division operator: multiplication of ``y`` by the inverse of ``x`` on the left. - Gives floating-point results for integer arguments. + Left division operator: multiplication of ``y`` by the inverse of ``x`` on the left. Gives floating-point results for integer arguments. .. _^: .. function:: ^(x, y) @@ -181,26 +180,25 @@ Mathematical Operators .. code-block:: julia x == fld(x,y)*y + mod(x,y) - x == (fld1(x,y)-1)*y + mod1(x,y) .. function:: mod1(x, y) .. Docstring generated from Julia source - Modulus after flooring division, returning a value in the range ``(0,y\]`` + Modulus after flooring division, returning a value in the range ``(0, y]``\ . .. function:: fldmod1(x, y) .. Docstring generated from Julia source - Return ``(fld1(x,y), mod1(x,y))`` + Return ``(fld1(x,y), mod1(x,y))``\ . .. function:: rem1(x, y) .. Docstring generated from Julia source - (Deprecated.) Remainder after division, returning in the range ``(0,y\]`` + (Deprecated.) Remainder after division, returning in the range ``(0, y]``\ . .. _//: .. function:: //(num, den) @@ -219,13 +217,13 @@ Mathematical Operators .. Docstring generated from Julia source - Numerator of the rational representation of ``x`` + Numerator of the rational representation of ``x``\ . .. function:: den(x) .. Docstring generated from Julia source - Denominator of the rational representation of ``x`` + Denominator of the rational representation of ``x``\ . .. _<<: .. function:: <<(x, n) @@ -249,12 +247,11 @@ Mathematical Operators Unsigned right bit shift operator. .. _\:: -.. function:: \:(start, [step], stop) +.. function:: :(start, [step], stop) .. Docstring generated from Julia source - Range operator. ``a:b`` constructs a range from ``a`` to ``b`` with a step size of 1, and ``a:s:b`` is similar but uses a step size of ``s``. These syntaxes call the function ``colon``. - The colon is also used in indexing to select whole dimensions. + Range operator. ``a:b`` constructs a range from ``a`` to ``b`` with a step size of 1, and ``a:s:b`` is similar but uses a step size of ``s``\ . These syntaxes call the function ``colon``\ . The colon is also used in indexing to select whole dimensions. .. function:: colon(start, [step], stop) @@ -295,7 +292,7 @@ Mathematical Operators .. Docstring generated from Julia source - See the :func:`is` operator + See the :func:`is` operator. .. _!==: .. function:: !==(x, y) @@ -303,7 +300,7 @@ Mathematical Operators .. Docstring generated from Julia source - Equivalent to ``!is(x, y)`` + Equivalent to ``!is(x, y)``\ . .. _<: .. function:: <(x, y) @@ -391,61 +388,61 @@ Mathematical Operators .. Docstring generated from Julia source - Bitwise not + Bitwise not. .. _&: .. function:: &(x, y) .. Docstring generated from Julia source - Bitwise and + Bitwise and. .. _|: .. function:: |(x, y) .. Docstring generated from Julia source - Bitwise or + Bitwise or. .. _$: .. function:: $(x, y) .. Docstring generated from Julia source - Bitwise exclusive or + Bitwise exclusive or. .. _!: .. function:: !(x) .. Docstring generated from Julia source - Boolean not + Boolean not. .. _&&: .. function:: x && y .. Docstring generated from Julia source - Short-circuiting boolean AND + Short-circuiting boolean AND. .. _||: .. function:: x || y .. Docstring generated from Julia source - Short-circuiting boolean OR + Short-circuiting boolean OR. .. function:: A_ldiv_Bc(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A` \\ :math:`Bᴴ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A` \\ :math:`Bᴴ`\ . .. function:: A_ldiv_Bt(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A` \\ :math:`Bᵀ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A` \\ :math:`Bᵀ`\ . .. function:: A_mul_B!(Y, A, B) -> Y @@ -466,97 +463,97 @@ Mathematical Operators .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A⋅Bᴴ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A⋅Bᴴ`\ . .. function:: A_mul_Bt(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A⋅Bᵀ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A⋅Bᵀ`\ . .. function:: A_rdiv_Bc(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A / Bᴴ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A / Bᴴ`\ . .. function:: A_rdiv_Bt(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A / Bᵀ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`A / Bᵀ`\ . .. function:: Ac_ldiv_B(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ` \\ :math:`B` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ` \\ :math:`B`\ . .. function:: Ac_ldiv_Bc(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ` \\ :math:`Bᴴ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ` \\ :math:`Bᴴ`\ . .. function:: Ac_mul_B(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ⋅B` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ⋅B`\ . .. function:: Ac_mul_Bc(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ Bᴴ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ Bᴴ`\ . .. function:: Ac_rdiv_B(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ / B` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ / B`\ . .. function:: Ac_rdiv_Bc(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ / Bᴴ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᴴ / Bᴴ`\ . .. function:: At_ldiv_B(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ` \\ :math:`B` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ` \\ :math:`B`\ . .. function:: At_ldiv_Bt(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ` \\ :math:`Bᵀ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ` \\ :math:`Bᵀ`\ . .. function:: At_mul_B(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ⋅B` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ⋅B`\ . .. function:: At_mul_Bt(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ⋅Bᵀ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ⋅Bᵀ`\ . .. function:: At_rdiv_B(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ / B` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ / B`\ . .. function:: At_rdiv_Bt(A, B) .. Docstring generated from Julia source - For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ / Bᵀ` + For matrices or vectors :math:`A` and :math:`B`\ , calculates :math:`Aᵀ / Bᵀ`\ . Mathematical Functions ---------------------- @@ -577,19 +574,19 @@ Mathematical Functions .. Docstring generated from Julia source - Compute sine of ``x``\ , where ``x`` is in radians + Compute sine of ``x``\ , where ``x`` is in radians. .. function:: cos(x) .. Docstring generated from Julia source - Compute cosine of ``x``\ , where ``x`` is in radians + Compute cosine of ``x``\ , where ``x`` is in radians. .. function:: tan(x) .. Docstring generated from Julia source - Compute tangent of ``x``\ , where ``x`` is in radians + Compute tangent of ``x``\ , where ``x`` is in radians. .. function:: sind(x) @@ -601,13 +598,13 @@ Mathematical Functions .. Docstring generated from Julia source - Compute cosine of ``x``\ , where ``x`` is in degrees + Compute cosine of ``x``\ , where ``x`` is in degrees. .. function:: tand(x) .. Docstring generated from Julia source - Compute tangent of ``x``\ , where ``x`` is in degrees + Compute tangent of ``x``\ , where ``x`` is in degrees. .. function:: sinpi(x) @@ -625,25 +622,25 @@ Mathematical Functions .. Docstring generated from Julia source - Compute hyperbolic sine of ``x`` + Compute hyperbolic sine of ``x``\ . .. function:: cosh(x) .. Docstring generated from Julia source - Compute hyperbolic cosine of ``x`` + Compute hyperbolic cosine of ``x``\ . .. function:: tanh(x) .. Docstring generated from Julia source - Compute hyperbolic tangent of ``x`` + Compute hyperbolic tangent of ``x``\ . .. function:: asin(x) .. Docstring generated from Julia source - Compute the inverse sine of ``x``\ , where the output is in radians + Compute the inverse sine of ``x``\ , where the output is in radians. .. function:: acos(x) @@ -655,7 +652,7 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the inverse tangent of ``x``\ , where the output is in radians + Compute the inverse tangent of ``x``\ , where the output is in radians. .. function:: atan2(y, x) @@ -667,61 +664,61 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the inverse sine of ``x``\ , where the output is in degrees + Compute the inverse sine of ``x``\ , where the output is in degrees. .. function:: acosd(x) .. Docstring generated from Julia source - Compute the inverse cosine of ``x``\ , where the output is in degrees + Compute the inverse cosine of ``x``\ , where the output is in degrees. .. function:: atand(x) .. Docstring generated from Julia source - Compute the inverse tangent of ``x``\ , where the output is in degrees + Compute the inverse tangent of ``x``\ , where the output is in degrees. .. function:: sec(x) .. Docstring generated from Julia source - Compute the secant of ``x``\ , where ``x`` is in radians + Compute the secant of ``x``\ , where ``x`` is in radians. .. function:: csc(x) .. Docstring generated from Julia source - Compute the cosecant of ``x``\ , where ``x`` is in radians + Compute the cosecant of ``x``\ , where ``x`` is in radians. .. function:: cot(x) .. Docstring generated from Julia source - Compute the cotangent of ``x``\ , where ``x`` is in radians + Compute the cotangent of ``x``\ , where ``x`` is in radians. .. function:: secd(x) .. Docstring generated from Julia source - Compute the secant of ``x``\ , where ``x`` is in degrees + Compute the secant of ``x``\ , where ``x`` is in degrees. .. function:: cscd(x) .. Docstring generated from Julia source - Compute the cosecant of ``x``\ , where ``x`` is in degrees + Compute the cosecant of ``x``\ , where ``x`` is in degrees. .. function:: cotd(x) .. Docstring generated from Julia source - Compute the cotangent of ``x``\ , where ``x`` is in degrees + Compute the cotangent of ``x``\ , where ``x`` is in degrees. .. function:: asec(x) .. Docstring generated from Julia source - Compute the inverse secant of ``x``\ , where the output is in radians + Compute the inverse secant of ``x``\ , where the output is in radians. .. function:: acsc(x) @@ -733,25 +730,25 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the inverse cotangent of ``x``\ , where the output is in radians + Compute the inverse cotangent of ``x``\ , where the output is in radians. .. function:: asecd(x) .. Docstring generated from Julia source - Compute the inverse secant of ``x``\ , where the output is in degrees + Compute the inverse secant of ``x``\ , where the output is in degrees. .. function:: acscd(x) .. Docstring generated from Julia source - Compute the inverse cosecant of ``x``\ , where the output is in degrees + Compute the inverse cosecant of ``x``\ , where the output is in degrees. .. function:: acotd(x) .. Docstring generated from Julia source - Compute the inverse cotangent of ``x``\ , where the output is in degrees + Compute the inverse cotangent of ``x``\ , where the output is in degrees. .. function:: sech(x) @@ -763,49 +760,49 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the hyperbolic cosecant of ``x`` + Compute the hyperbolic cosecant of ``x``\ . .. function:: coth(x) .. Docstring generated from Julia source - Compute the hyperbolic cotangent of ``x`` + Compute the hyperbolic cotangent of ``x``\ . .. function:: asinh(x) .. Docstring generated from Julia source - Compute the inverse hyperbolic sine of ``x`` + Compute the inverse hyperbolic sine of ``x``\ . .. function:: acosh(x) .. Docstring generated from Julia source - Compute the inverse hyperbolic cosine of ``x`` + Compute the inverse hyperbolic cosine of ``x``\ . .. function:: atanh(x) .. Docstring generated from Julia source - Compute the inverse hyperbolic tangent of ``x`` + Compute the inverse hyperbolic tangent of ``x``\ . .. function:: asech(x) .. Docstring generated from Julia source - Compute the inverse hyperbolic secant of ``x`` + Compute the inverse hyperbolic secant of ``x``\ . .. function:: acsch(x) .. Docstring generated from Julia source - Compute the inverse hyperbolic cosecant of ``x`` + Compute the inverse hyperbolic cosecant of ``x``\ . .. function:: acoth(x) .. Docstring generated from Julia source - Compute the inverse hyperbolic cotangent of ``x`` + Compute the inverse hyperbolic cotangent of ``x``\ . .. function:: sinc(x) @@ -823,19 +820,19 @@ Mathematical Functions .. Docstring generated from Julia source - Convert ``x`` from degrees to radians + Convert ``x`` from degrees to radians. .. function:: rad2deg(x) .. Docstring generated from Julia source - Convert ``x`` from radians to degrees + Convert ``x`` from radians to degrees. .. function:: hypot(x, y) .. Docstring generated from Julia source - Compute the :math:`\sqrt{x^2+y^2}` avoiding overflow and underflow + Compute the :math:`\sqrt{x^2+y^2}` avoiding overflow and underflow. .. function:: log(x) @@ -917,60 +914,50 @@ Mathematical Functions .. Docstring generated from Julia source - ``round(x)`` rounds ``x`` to an integer value according to the default - rounding mode (see :func:`rounding`), returning a value of the same type as - ``x``. By default (:obj:`RoundNearest`), this will round to the nearest - integer, with ties (fractional values of 0.5) being rounded to the even - integer. + ``round(x)`` rounds ``x`` to an integer value according to the default rounding mode (see :func:`rounding`\ ), returning a value of the same type as ``x``\ . By default (:obj:`RoundNearest`\ ), this will round to the nearest integer, with ties (fractional values of 0.5) being rounded to the even integer. .. doctest:: - julia> round(1.7) - 2.0 + julia> round(1.7) + 2.0 - julia> round(1.5) - 2.0 + julia> round(1.5) + 2.0 - julia> round(2.5) - 2.0 + julia> round(2.5) + 2.0 The optional :obj:`RoundingMode` argument will change how the number gets rounded. - ``round(T, x, [r::RoundingMode])`` converts the result to type ``T``, throwing an - :exc:`InexactError` if the value is not representable. + ``round(T, x, [r::RoundingMode])`` converts the result to type ``T``\ , throwing an :exc:`InexactError` if the value is not representable. - ``round(x, digits)`` rounds to the specified number of digits after the - decimal place (or before if negative). ``round(x, digits, base)`` rounds - using a base other than 10. + ``round(x, digits)`` rounds to the specified number of digits after the decimal place (or before if negative). ``round(x, digits, base)`` rounds using a base other than 10. .. doctest:: - julia> round(pi, 2) - 3.14 + julia> round(pi, 2) + 3.14 - julia> round(pi, 3, 2) - 3.125 + julia> round(pi, 3, 2) + 3.125 - .. note:: + **note** - Rounding to specified digits in bases other than 2 can be inexact when - operating on binary floating point numbers. For example, the ``Float64`` - value represented by ``1.15`` is actually *less* than 1.15, yet will be - rounded to 1.2. + Rounding to specified digits in bases other than 2 can be inexact when operating on binary floating point numbers. For example, the ``Float64`` value represented by ``1.15`` is actually *less* than 1.15, yet will be rounded to 1.2. - .. doctest:: + .. doctest:: - julia> x = 1.15 - 1.15 + julia> x = 1.15 + 1.15 - julia> @sprintf "%.20f" x - "1.14999999999999991118" + julia> @sprintf "%.20f" x + "1.14999999999999991118" - julia> x < 115//100 - true + julia> x < 115//100 + true - julia> round(x, 1) - 1.2 + julia> round(x, 1) + 1.2 .. data:: RoundingMode @@ -1014,46 +1001,37 @@ Mathematical Functions .. Docstring generated from Julia source - Returns the nearest integral value of the same type as the complex-valued - ``z`` to ``z``, breaking ties using the specified :obj:`RoundingMode`\ s. - The first :obj:`RoundingMode` is used for rounding the real components while - the second is used for rounding the imaginary components. + Returns the nearest integral value of the same type as the complex-valued ``z`` to ``z``\ , breaking ties using the specified :obj:`RoundingMode`\ s. The first :obj:`RoundingMode` is used for rounding the real components while the second is used for rounding the imaginary components. .. function:: ceil([T,] x, [digits, [base]]) .. Docstring generated from Julia source - ``ceil(x)`` returns the nearest integral value of the same type as ``x`` - that is greater than or equal to ``x``. + ``ceil(x)`` returns the nearest integral value of the same type as ``x`` that is greater than or equal to ``x``\ . - ``ceil(T, x)`` converts the result to type ``T``, throwing an - ``InexactError`` if the value is not representable. + ``ceil(T, x)`` converts the result to type ``T``\ , throwing an ``InexactError`` if the value is not representable. - ``digits`` and ``base`` work as for :func:`round`. + ``digits`` and ``base`` work as for :func:`round`\ . .. function:: floor([T,] x, [digits, [base]]) .. Docstring generated from Julia source - ``floor(x)`` returns the nearest integral value of the same type as ``x`` - that is less than or equal to ``x``. + ``floor(x)`` returns the nearest integral value of the same type as ``x`` that is less than or equal to ``x``\ . - ``floor(T, x)`` converts the result to type ``T``, throwing an - ``InexactError`` if the value is not representable. + ``floor(T, x)`` converts the result to type ``T``\ , throwing an ``InexactError`` if the value is not representable. - ``digits`` and ``base`` work as for :func:`round`. + ``digits`` and ``base`` work as for :func:`round`\ . .. function:: trunc([T,] x, [digits, [base]]) .. Docstring generated from Julia source - ``trunc(x)`` returns the nearest integral value of the same type as ``x`` whose absolute - value is less than or equal to ``x``. + ``trunc(x)`` returns the nearest integral value of the same type as ``x`` whose absolute value is less than or equal to ``x``\ . - ``trunc(T, x)`` converts the result to type ``T``, throwing an - ``InexactError`` if the value is not representable. + ``trunc(T, x)`` converts the result to type ``T``\ , throwing an ``InexactError`` if the value is not representable. - ``digits`` and ``base`` work as for :func:`round`. + ``digits`` and ``base`` work as for :func:`round`\ . .. function:: unsafe_trunc(T, x) @@ -1083,8 +1061,7 @@ Mathematical Functions .. Docstring generated from Julia source - Return ``(min(x,y), max(x,y))``. - See also: :func:`extrema` that returns ``(minimum(x), maximum(x))`` + Return ``(min(x,y), max(x,y))``\ . See also: :func:`extrema` that returns ``(minimum(x), maximum(x))``\ . .. function:: clamp(x, lo, hi) @@ -1184,7 +1161,7 @@ Mathematical Functions .. Docstring generated from Julia source - Squared absolute value of ``x`` + Squared absolute value of ``x``\ . .. function:: copysign(x, y) @@ -1244,7 +1221,7 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the scaled complementary error function of ``x``\ , defined by :math:`e^{x^2} \operatorname{erfc}(x)`\ . Note also that :math:`\operatorname{erfcx}(-ix)` computes the Faddeeva function :math:`w(x)`\ . + Compute the scaled complementary error function of ``x``\ , defined by :math:`e^{x^2} \operatorname{erfc}(x)`\ . Note also that :math:`\operatorname{erfcx}(-ix)` computes the Faddeeva function :math:`w(x)`\ . .. function:: erfi(x) @@ -1274,31 +1251,31 @@ Mathematical Functions .. Docstring generated from Julia source - Return the real part of the complex number ``z`` + Return the real part of the complex number ``z``\ . .. function:: imag(z) .. Docstring generated from Julia source - Return the imaginary part of the complex number ``z`` + Return the imaginary part of the complex number ``z``\ . .. function:: reim(z) .. Docstring generated from Julia source - Return both the real and imaginary parts of the complex number ``z`` + Return both the real and imaginary parts of the complex number ``z``\ . .. function:: conj(z) .. Docstring generated from Julia source - Compute the complex conjugate of a complex number ``z`` + Compute the complex conjugate of a complex number ``z``\ . .. function:: angle(z) .. Docstring generated from Julia source - Compute the phase angle in radians of a complex number ``z`` + Compute the phase angle in radians of a complex number ``z``\ . .. function:: cis(z) @@ -1310,24 +1287,19 @@ Mathematical Functions .. Docstring generated from Julia source - Number of ways to choose ``k`` out of ``n`` items + Number of ways to choose ``k`` out of ``n`` items. .. function:: factorial(n) .. Docstring generated from Julia source - Factorial of ``n``. If ``n`` is an :obj:`Integer`, the factorial - is computed as an integer (promoted to at least 64 bits). Note - that this may overflow if ``n`` is not small, but you can use - ``factorial(big(n))`` to compute the result exactly in arbitrary - precision. If ``n`` is not an ``Integer``, ``factorial(n)`` is - equivalent to :func:`gamma(n+1) `. + Factorial of ``n``\ . If ``n`` is an :obj:`Integer`\ , the factorial is computed as an integer (promoted to at least 64 bits). Note that this may overflow if ``n`` is not small, but you can use ``factorial(big(n))`` to compute the result exactly in arbitrary precision. If ``n`` is not an ``Integer``\ , ``factorial(n)`` is equivalent to :func:`gamma(n+1) `\ . .. function:: factorial(n,k) .. Docstring generated from Julia source - Compute ``factorial(n)/factorial(k)`` + Compute ``factorial(n)/factorial(k)``\ . .. function:: factor(n) -> Dict @@ -1358,27 +1330,27 @@ Mathematical Functions .. Docstring generated from Julia source - Computes the greatest common (positive) divisor of ``x`` and ``y`` and their Bézout coefficients, i.e. the integer coefficients ``u`` and ``v`` that satisfy :math:`ux+vy = d = gcd(x,y)`. + Computes the greatest common (positive) divisor of ``x`` and ``y`` and their Bézout coefficients, i.e. the integer coefficients ``u`` and ``v`` that satisfy :math:`ux+vy = d = gcd(x,y)`\ . .. doctest:: - julia> gcdx(12, 42) - (6,-3,1) + julia> gcdx(12, 42) + (6,-3,1) .. doctest:: - julia> gcdx(240, 46) - (2,-9,47) + julia> gcdx(240, 46) + (2,-9,47) - .. note:: + **note** - Bézout coefficients are *not* uniquely defined. ``gcdx`` returns the minimal Bézout coefficients that are computed by the extended Euclid algorithm. (Ref: D. Knuth, TAoCP, 2/e, p. 325, Algorithm X.) These coefficients ``u`` and ``v`` are minimal in the sense that :math:`|u| < |\frac y d` and :math:`|v| < |\frac x d`. Furthermore, the signs of ``u`` and ``v`` are chosen so that ``d`` is positive. + Bézout coefficients are *not* uniquely defined. ``gcdx`` returns the minimal Bézout coefficients that are computed by the extended Euclid algorithm. (Ref: D. Knuth, TAoCP, 2/e, p. 325, Algorithm X.) These coefficients ``u`` and ``v`` are minimal in the sense that :math:`|u| < |\frac y d` and :math:`|v| < |\frac x d`\ . Furthermore, the signs of ``u`` and ``v`` are chosen so that ``d`` is positive. .. function:: ispow2(n) -> Bool .. Docstring generated from Julia source - Test whether ``n`` is a power of two + Test whether ``n`` is a power of two. .. function:: nextpow2(n) @@ -1410,7 +1382,13 @@ Mathematical Functions Next integer not less than ``n`` that can be written as :math:`\prod k_i^{p_i}` for integers :math:`p_1`\ , :math:`p_2`\ , etc. - For a list of integers i1, i2, i3, find the smallest i1^n1 * i2^n2 * i3^n3 >= x for integer n1, n2, n3 + For a list of integers i1, i2, i3, find the smallest + + .. code-block:: julia + + i1^n1 * i2^n2 * i3^n3 >= x + + for integer n1, n2, n3 .. function:: invmod(x,m) @@ -1428,15 +1406,13 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the gamma function of ``x`` + Compute the gamma function of ``x``\ . .. function:: lgamma(x) .. Docstring generated from Julia source - Compute the logarithm of the absolute value of :func:`gamma` for - :obj:`Real` ``x``, while for :obj:`Complex` ``x`` it computes the - logarithm of ``gamma(x)``. + Compute the logarithm of the absolute value of :func:`gamma` for :obj:`Real` ``x``\ , while for :obj:`Complex` ``x`` it computes the logarithm of ``gamma(x)``\ . .. function:: lfact(x) @@ -1460,7 +1436,7 @@ Mathematical Functions .. Docstring generated from Julia source - Compute the trigamma function of ``x`` (the logarithmic second derivative of ``gamma(x)``\ ) + Compute the trigamma function of ``x`` (the logarithmic second derivative of ``gamma(x)``\ ). .. function:: polygamma(m, x) @@ -1856,7 +1832,7 @@ multi-threading. Use ``FFTW.set_num_threads(np)`` to use ``np`` threads. .. Docstring generated from Julia source - Performs a multidimensional FFT of the array ``A``\ . The optional ``dims`` argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of ``A`` along the transformed dimensions is a product of small primes; see ``nextprod()``\ . See also ``plan_fft()`` for even greater efficiency. + Performs a multidimensional FFT of the array ``A``\ . The optional ``dims`` argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of ``A`` along the transformed dimensions is a product of small primes; see ``nextprod()``\ . See also ``plan_fft()`` for even greater efficiency. A one-dimensional FFT computes the one-dimensional discrete Fourier transform (DFT) as defined by @@ -1875,8 +1851,7 @@ multi-threading. Use ``FFTW.set_num_threads(np)`` to use ``np`` threads. .. Docstring generated from Julia source - Same as :func:`fft`, but operates in-place on ``A``, - which must be an array of complex floating-point numbers. + Same as :func:`fft`\ , but operates in-place on ``A``\ , which must be an array of complex floating-point numbers. .. function:: ifft(A [, dims]) @@ -1898,227 +1873,153 @@ multi-threading. Use ``FFTW.set_num_threads(np)`` to use ``np`` threads. .. Docstring generated from Julia source - Same as :func:`ifft`, but operates in-place on ``A``. + Same as :func:`ifft`\ , but operates in-place on ``A``\ . .. function:: bfft(A [, dims]) .. Docstring generated from Julia source - Similar to :func:`ifft`, but computes an unnormalized inverse (backward) - transform, which must be divided by the product of the sizes of the - transformed dimensions in order to obtain the inverse. (This is slightly - more efficient than :func:`ifft` because it omits a scaling step, which in - some applications can be combined with other computational steps elsewhere.) + Similar to :func:`ifft`\ , but computes an unnormalized inverse (backward) transform, which must be divided by the product of the sizes of the transformed dimensions in order to obtain the inverse. (This is slightly more efficient than :func:`ifft` because it omits a scaling step, which in some applications can be combined with other computational steps elsewhere.) .. math:: - \operatorname{BDFT}(A)[k] = \operatorname{length}(A) \operatorname{IDFT}(A)[k] + \operatorname{BDFT}(A)[k] = \operatorname{length}(A) \operatorname{IDFT}(A)[k] .. function:: bfft!(A [, dims]) .. Docstring generated from Julia source - Same as :func:`bfft`, but operates in-place on ``A``. + Same as :func:`bfft`\ , but operates in-place on ``A``\ . .. function:: plan_fft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Pre-plan an optimized FFT along given dimensions (``dims``) of arrays - matching the shape and type of ``A``. (The first two arguments have - the same meaning as for :func:`fft`.) Returns an object ``P`` which - represents the linear operator computed by the FFT, and which contains - all of the information needed to compute ``fft(A, dims)`` quickly. - - To apply ``P`` to an array ``A``, use ``P * A``; in general, the - syntax for applying plans is much like that of matrices. (A plan - can only be applied to arrays of the same size as the ``A`` for - which the plan was created.) You can also apply a plan with a - preallocated output array ``Â`` by calling ``A_mul_B!(Â, plan, - A)``. You can compute the inverse-transform plan by ``inv(P)`` and - apply the inverse plan with ``P \ Â`` (the inverse plan is cached - and reused for subsequent calls to ``inv`` or ``\``), and apply the - inverse plan to a pre-allocated output array ``A`` with - ``A_ldiv_B!(A, P, Â)``. - - The ``flags`` argument is a bitwise-or of FFTW planner flags, defaulting - to ``FFTW.ESTIMATE``. e.g. passing ``FFTW.MEASURE`` or ``FFTW.PATIENT`` - will instead spend several seconds (or more) benchmarking different - possible FFT algorithms and picking the fastest one; see the FFTW manual - for more information on planner flags. The optional ``timelimit`` argument - specifies a rough upper bound on the allowed planning time, in seconds. - Passing ``FFTW.MEASURE`` or ``FFTW.PATIENT`` may cause the input array ``A`` - to be overwritten with zeros during plan creation. - - :func:`plan_fft!` is the same as :func:`plan_fft` but creates a plan - that operates in-place on its argument (which must be an array of - complex floating-point numbers). :func:`plan_ifft` and so on - are similar but produce plans that perform the equivalent of - the inverse transforms :func:`ifft` and so on. + Pre-plan an optimized FFT along given dimensions (``dims``\ ) of arrays matching the shape and type of ``A``\ . (The first two arguments have the same meaning as for :func:`fft`\ .) Returns an object ``P`` which represents the linear operator computed by the FFT, and which contains all of the information needed to compute ``fft(A, dims)`` quickly. + + To apply ``P`` to an array ``A``\ , use ``P * A``\ ; in general, the syntax for applying plans is much like that of matrices. (A plan can only be applied to arrays of the same size as the ``A`` for which the plan was created.) You can also apply a plan with a preallocated output array ``Â`` by calling ``A_mul_B!(Â, plan, A)``\ . You can compute the inverse-transform plan by ``inv(P)`` and apply the inverse plan with ``P \ Â`` (the inverse plan is cached and reused for subsequent calls to ``inv`` or ``\``\ ), and apply the inverse plan to a pre-allocated output array ``A`` with ``A_ldiv_B!(A, P, Â)``\ . + + The ``flags`` argument is a bitwise-or of FFTW planner flags, defaulting to ``FFTW.ESTIMATE``\ . e.g. passing ``FFTW.MEASURE`` or ``FFTW.PATIENT`` will instead spend several seconds (or more) benchmarking different possible FFT algorithms and picking the fastest one; see the FFTW manual for more information on planner flags. The optional ``timelimit`` argument specifies a rough upper bound on the allowed planning time, in seconds. Passing ``FFTW.MEASURE`` or ``FFTW.PATIENT`` may cause the input array ``A`` to be overwritten with zeros during plan creation. + + :func:`plan_fft!` is the same as :func:`plan_fft` but creates a plan that operates in-place on its argument (which must be an array of complex floating-point numbers). :func:`plan_ifft` and so on are similar but produce plans that perform the equivalent of the inverse transforms :func:`ifft` and so on. .. function:: plan_ifft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Same as :func:`plan_fft`, but produces a plan that performs inverse transforms - :func:`ifft`. + Same as :func:`plan_fft`\ , but produces a plan that performs inverse transforms :func:`ifft`\ . .. function:: plan_bfft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Same as :func:`plan_fft`, but produces a plan that performs an unnormalized - backwards transform :func:`bfft`. + Same as :func:`plan_fft`\ , but produces a plan that performs an unnormalized backwards transform :func:`bfft`\ . .. function:: plan_fft!(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Same as :func:`plan_fft`, but operates in-place on ``A``. + Same as :func:`plan_fft`\ , but operates in-place on ``A``\ . .. function:: plan_ifft!(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Same as :func:`plan_ifft`, but operates in-place on ``A``. + Same as :func:`plan_ifft`\ , but operates in-place on ``A``\ . .. function:: plan_bfft!(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Same as :func:`plan_bfft`, but operates in-place on ``A``. + Same as :func:`plan_bfft`\ , but operates in-place on ``A``\ . .. function:: rfft(A [, dims]) .. Docstring generated from Julia source - Multidimensional FFT of a real array ``A``, exploiting the fact that - the transform has conjugate symmetry in order to save roughly half - the computational time and storage costs compared with :func:`fft`. - If ``A`` has size ``(n_1, ..., n_d)``, the result has size - ``(div(n_1,2)+1, ..., n_d)``. + Multidimensional FFT of a real array ``A``\ , exploiting the fact that the transform has conjugate symmetry in order to save roughly half the computational time and storage costs compared with :func:`fft`\ . If ``A`` has size ``(n_1, ..., n_d)``\ , the result has size ``(div(n_1,2)+1, ..., n_d)``\ . - The optional ``dims`` argument specifies an iterable subset of one or - more dimensions of ``A`` to transform, similar to :func:`fft`. Instead - of (roughly) halving the first dimension of ``A`` in the result, the - ``dims[1]`` dimension is (roughly) halved in the same way. + The optional ``dims`` argument specifies an iterable subset of one or more dimensions of ``A`` to transform, similar to :func:`fft`\ . Instead of (roughly) halving the first dimension of ``A`` in the result, the ``dims[1]`` dimension is (roughly) halved in the same way. .. function:: irfft(A, d [, dims]) .. Docstring generated from Julia source - Inverse of :func:`rfft`: for a complex array ``A``, gives the - corresponding real array whose FFT yields ``A`` in the first half. - As for :func:`rfft`, ``dims`` is an optional subset of dimensions - to transform, defaulting to ``1:ndims(A)``. + Inverse of :func:`rfft`\ : for a complex array ``A``\ , gives the corresponding real array whose FFT yields ``A`` in the first half. As for :func:`rfft`\ , ``dims`` is an optional subset of dimensions to transform, defaulting to ``1:ndims(A)``\ . - ``d`` is the length of the transformed real array along the ``dims[1]`` - dimension, which must satisfy ``div(d,2)+1 == size(A,dims[1])``. - (This parameter cannot be inferred from ``size(A)`` since both - ``2*size(A,dims[1])-2`` as well as ``2*size(A,dims[1])-1`` are valid sizes - for the transformed real array.) + ``d`` is the length of the transformed real array along the ``dims[1]`` dimension, which must satisfy ``div(d,2)+1 == size(A,dims[1])``\ . (This parameter cannot be inferred from ``size(A)`` since both ``2*size(A,dims[1])-2`` as well as ``2*size(A,dims[1])-1`` are valid sizes for the transformed real array.) .. function:: brfft(A, d [, dims]) .. Docstring generated from Julia source - Similar to :func:`irfft` but computes an unnormalized inverse transform - (similar to :func:`bfft`), which must be divided by the product - of the sizes of the transformed dimensions (of the real output array) - in order to obtain the inverse transform. + Similar to :func:`irfft` but computes an unnormalized inverse transform (similar to :func:`bfft`\ ), which must be divided by the product of the sizes of the transformed dimensions (of the real output array) in order to obtain the inverse transform. .. function:: plan_rfft(A [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Pre-plan an optimized real-input FFT, similar to :func:`plan_fft` - except for :func:`rfft` instead of :func:`fft`. The first two - arguments, and the size of the transformed result, are the same as - for :func:`rfft`. + Pre-plan an optimized real-input FFT, similar to :func:`plan_fft` except for :func:`rfft` instead of :func:`fft`\ . The first two arguments, and the size of the transformed result, are the same as for :func:`rfft`\ . .. function:: plan_brfft(A, d [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Pre-plan an optimized real-input unnormalized transform, similar to - :func:`plan_rfft` except for :func:`brfft` instead of :func:`rfft`. - The first two arguments and the size of the transformed result, are - the same as for :func:`brfft`. + Pre-plan an optimized real-input unnormalized transform, similar to :func:`plan_rfft` except for :func:`brfft` instead of :func:`rfft`\ . The first two arguments and the size of the transformed result, are the same as for :func:`brfft`\ . .. function:: plan_irfft(A, d [, dims]; flags=FFTW.ESTIMATE; timelimit=Inf) .. Docstring generated from Julia source - Pre-plan an optimized inverse real-input FFT, similar to :func:`plan_rfft` - except for :func:`irfft` and :func:`brfft`, respectively. The first - three arguments have the same meaning as for :func:`irfft`. + Pre-plan an optimized inverse real-input FFT, similar to :func:`plan_rfft` except for :func:`irfft` and :func:`brfft`\ , respectively. The first three arguments have the same meaning as for :func:`irfft`\ . .. function:: dct(A [, dims]) .. Docstring generated from Julia source - Performs a multidimensional type-II discrete cosine transform (DCT) - of the array ``A``, using the unitary normalization of the DCT. - The optional ``dims`` argument specifies an iterable subset of - dimensions (e.g. an integer, range, tuple, or array) to transform - along. Most efficient if the size of ``A`` along the transformed - dimensions is a product of small primes; see :func:`nextprod`. See - also :func:`plan_dct` for even greater efficiency. + Performs a multidimensional type-II discrete cosine transform (DCT) of the array ``A``\ , using the unitary normalization of the DCT. The optional ``dims`` argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of ``A`` along the transformed dimensions is a product of small primes; see :func:`nextprod`\ . See also :func:`plan_dct` for even greater efficiency. .. function:: dct!(A [, dims]) .. Docstring generated from Julia source - Same as :func:`dct!`, except that it operates in-place - on ``A``, which must be an array of real or complex floating-point - values. + Same as :func:`dct!`\ , except that it operates in-place on ``A``\ , which must be an array of real or complex floating-point values. .. function:: idct(A [, dims]) .. Docstring generated from Julia source - Computes the multidimensional inverse discrete cosine transform (DCT) - of the array ``A`` (technically, a type-III DCT with the unitary - normalization). - The optional ``dims`` argument specifies an iterable subset of - dimensions (e.g. an integer, range, tuple, or array) to transform - along. Most efficient if the size of ``A`` along the transformed - dimensions is a product of small primes; see :func:`nextprod`. See - also :func:`plan_idct` for even greater efficiency. + Computes the multidimensional inverse discrete cosine transform (DCT) of the array ``A`` (technically, a type-III DCT with the unitary normalization). The optional ``dims`` argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. Most efficient if the size of ``A`` along the transformed dimensions is a product of small primes; see :func:`nextprod`\ . See also :func:`plan_idct` for even greater efficiency. .. function:: idct!(A [, dims]) .. Docstring generated from Julia source - Same as :func:`idct!`, but operates in-place on ``A``. + Same as :func:`idct!`\ , but operates in-place on ``A``\ . .. function:: plan_dct(A [, dims [, flags [, timelimit]]]) .. Docstring generated from Julia source - Pre-plan an optimized discrete cosine transform (DCT), similar to - :func:`plan_fft` except producing a function that computes :func:`dct`. - The first two arguments have the same meaning as for :func:`dct`. + Pre-plan an optimized discrete cosine transform (DCT), similar to :func:`plan_fft` except producing a function that computes :func:`dct`\ . The first two arguments have the same meaning as for :func:`dct`\ . .. function:: plan_dct!(A [, dims [, flags [, timelimit]]]) .. Docstring generated from Julia source - Same as :func:`plan_dct`, but operates in-place on ``A``. + Same as :func:`plan_dct`\ , but operates in-place on ``A``\ . .. function:: plan_idct(A [, dims [, flags [, timelimit]]]) .. Docstring generated from Julia source - Pre-plan an optimized inverse discrete cosine transform (DCT), similar to - :func:`plan_fft` except producing a function that computes :func:`idct`. - The first two arguments have the same meaning as for :func:`idct`. + Pre-plan an optimized inverse discrete cosine transform (DCT), similar to :func:`plan_fft` except producing a function that computes :func:`idct`\ . The first two arguments have the same meaning as for :func:`idct`\ . .. function:: plan_idct!(A [, dims [, flags [, timelimit]]]) .. Docstring generated from Julia source - Same as :func:`plan_idct`, but operates in-place on ``A``. + Same as :func:`plan_idct`\ , but operates in-place on ``A``\ . .. function:: fftshift(x) @@ -2148,8 +2049,7 @@ multi-threading. Use ``FFTW.set_num_threads(np)`` to use ``np`` threads. .. Docstring generated from Julia source - Same as :func:`filt` but writes the result into the ``out`` argument, - which may alias the input ``x`` to modify it in-place. + Same as :func:`filt` but writes the result into the ``out`` argument, which may alias the input ``x`` to modify it in-place. .. function:: deconv(b,a) @@ -2167,13 +2067,13 @@ multi-threading. Use ``FFTW.set_num_threads(np)`` to use ``np`` threads. .. Docstring generated from Julia source - 2-D convolution of the matrix ``A`` with the 2-D separable kernel generated by the vectors ``u`` and ``v``\ . Uses 2-D FFT algorithm + 2-D convolution of the matrix ``A`` with the 2-D separable kernel generated by the vectors ``u`` and ``v``\ . Uses 2-D FFT algorithm. .. function:: conv2(B,A) .. Docstring generated from Julia source - 2-D convolution of the matrix ``B`` with the matrix ``A``\ . Uses 2-D FFT algorithm + 2-D convolution of the matrix ``B`` with the matrix ``A``\ . Uses 2-D FFT algorithm. .. function:: xcorr(u,v) @@ -2189,24 +2089,9 @@ The following functions are defined within the ``Base.FFTW`` module. .. Docstring generated from Julia source - Performs a multidimensional real-input/real-output (r2r) transform - of type ``kind`` of the array ``A``, as defined in the FFTW manual. - ``kind`` specifies either a discrete cosine transform of various types - (``FFTW.REDFT00``, ``FFTW.REDFT01``, ``FFTW.REDFT10``, or - ``FFTW.REDFT11``), a discrete sine transform of various types - (``FFTW.RODFT00``, ``FFTW.RODFT01``, ``FFTW.RODFT10``, or - ``FFTW.RODFT11``), a real-input DFT with halfcomplex-format output - (``FFTW.R2HC`` and its inverse ``FFTW.HC2R``), or a discrete - Hartley transform (``FFTW.DHT``). The ``kind`` argument may be - an array or tuple in order to specify different transform types - along the different dimensions of ``A``; ``kind[end]`` is used - for any unspecified dimensions. See the FFTW manual for precise - definitions of these transform types, at http://www.fftw.org/doc. + Performs a multidimensional real-input/real-output (r2r) transform of type ``kind`` of the array ``A``\ , as defined in the FFTW manual. ``kind`` specifies either a discrete cosine transform of various types (``FFTW.REDFT00``\ , ``FFTW.REDFT01``\ , ``FFTW.REDFT10``\ , or ``FFTW.REDFT11``\ ), a discrete sine transform of various types (``FFTW.RODFT00``\ , ``FFTW.RODFT01``\ , ``FFTW.RODFT10``\ , or ``FFTW.RODFT11``\ ), a real-input DFT with halfcomplex-format output (``FFTW.R2HC`` and its inverse ``FFTW.HC2R``\ ), or a discrete Hartley transform (``FFTW.DHT``\ ). The ``kind`` argument may be an array or tuple in order to specify different transform types along the different dimensions of ``A``\ ; ``kind[end]`` is used for any unspecified dimensions. See the FFTW manual for precise definitions of these transform types, at http://www.fftw.org/doc. - The optional ``dims`` argument specifies an iterable subset of - dimensions (e.g. an integer, range, tuple, or array) to transform - along. ``kind[i]`` is then the transform type for ``dims[i]``, - with ``kind[end]`` being used for ``i > length(kind)``. + The optional ``dims`` argument specifies an iterable subset of dimensions (e.g. an integer, range, tuple, or array) to transform along. ``kind[i]`` is then the transform type for ``dims[i]``\ , with ``kind[end]`` being used for ``i > length(kind)``\ . See also :func:`plan_r2r` to pre-plan optimized r2r transforms. @@ -2214,22 +2099,19 @@ The following functions are defined within the ``Base.FFTW`` module. .. Docstring generated from Julia source - Same as :func:`r2r`, but operates in-place on ``A``, which must be - an array of real or complex floating-point numbers. + Same as :func:`r2r`\ , but operates in-place on ``A``\ , which must be an array of real or complex floating-point numbers. .. function:: plan_r2r(A, kind [, dims [, flags [, timelimit]]]) .. Docstring generated from Julia source - Pre-plan an optimized r2r transform, similar to :func:`Base.plan_fft` - except that the transforms (and the first three arguments) - correspond to :func:`r2r` and :func:`r2r!`, respectively. + Pre-plan an optimized r2r transform, similar to :func:`Base.plan_fft` except that the transforms (and the first three arguments) correspond to :func:`r2r` and :func:`r2r!`\ , respectively. .. function:: plan_r2r!(A, kind [, dims [, flags [, timelimit]]]) .. Docstring generated from Julia source - Similar to :func:`Base.plan_fft`, but corresponds to :func:`r2r!`. + Similar to :func:`Base.plan_fft`\ , but corresponds to :func:`r2r!`\ . .. currentmodule:: Base diff --git a/doc/stdlib/numbers.rst b/doc/stdlib/numbers.rst index 6c791df2fd935..7bbbbe81fd347 100644 --- a/doc/stdlib/numbers.rst +++ b/doc/stdlib/numbers.rst @@ -126,19 +126,19 @@ Data Formats .. Docstring generated from Julia source - Byte-swap an integer + Byte-swap an integer. .. function:: num2hex(f) .. Docstring generated from Julia source - Get a hexadecimal string of the binary representation of a floating point number + Get a hexadecimal string of the binary representation of a floating point number. .. function:: hex2num(str) .. Docstring generated from Julia source - Convert a hexadecimal string to the floating point number it represents + Convert a hexadecimal string to the floating point number it represents. .. function:: hex2bytes(s::ASCIIString) @@ -223,7 +223,7 @@ General Number Functions and Constants .. Docstring generated from Julia source - Test whether a floating point number is subnormal + Test whether a floating point number is subnormal. .. function:: isfinite(f) -> Bool @@ -235,19 +235,19 @@ General Number Functions and Constants .. Docstring generated from Julia source - Test whether a number is infinite + Test whether a number is infinite. .. function:: isnan(f) -> Bool .. Docstring generated from Julia source - Test whether a floating point number is not a number (NaN) + Test whether a floating point number is not a number (NaN). .. function:: inf(f) .. Docstring generated from Julia source - Returns positive infinity of the floating point type ``f`` or of the same floating point type as ``f`` + Returns positive infinity of the floating point type ``f`` or of the same floating point type as ``f``\ . .. function:: nan(f) @@ -259,13 +259,13 @@ General Number Functions and Constants .. Docstring generated from Julia source - Get the next floating point number in lexicographic order + Get the next floating point number in lexicographic order. .. function:: prevfloat(f) -> AbstractFloat .. Docstring generated from Julia source - Get the previous floating point number in lexicographic order + Get the previous floating point number in lexicographic order. .. function:: isinteger(x) -> Bool @@ -277,7 +277,7 @@ General Number Functions and Constants .. Docstring generated from Julia source - Test whether ``x`` or all its elements are numerically equal to some real number + Test whether ``x`` or all its elements are numerically equal to some real number. .. function:: Float32(x [, mode::RoundingMode]) @@ -315,57 +315,41 @@ General Number Functions and Constants .. Docstring generated from Julia source - Create an arbitrary precision integer. ``x`` may be an ``Int`` (or anything - that can be converted to an ``Int``). The usual mathematical operators are - defined for this type, and results are promoted to a ``BigInt``. + Create an arbitrary precision integer. ``x`` may be an ``Int`` (or anything that can be converted to an ``Int``\ ). The usual mathematical operators are defined for this type, and results are promoted to a ``BigInt``\ . - Instances can be constructed from strings via :func:`parse`, or using the - ``big`` string literal. + Instances can be constructed from strings via :func:`parse`\ , or using the ``big`` string literal. .. function:: BigFloat(x) .. Docstring generated from Julia source - Create an arbitrary precision floating point number. ``x`` may be - an ``Integer``, a ``Float64`` or a ``BigInt``. The - usual mathematical operators are defined for this type, and results - are promoted to a ``BigFloat``. + Create an arbitrary precision floating point number. ``x`` may be an ``Integer``\ , a ``Float64`` or a ``BigInt``\ . The usual mathematical operators are defined for this type, and results are promoted to a ``BigFloat``\ . - Note that because decimal literals are converted to floating point numbers - when parsed, ``BigFloat(2.1)`` may not yield what you expect. You may instead - prefer to initialize constants from strings via :func:`parse`, or using the - ``big`` string literal. + Note that because decimal literals are converted to floating point numbers when parsed, ``BigFloat(2.1)`` may not yield what you expect. You may instead prefer to initialize constants from strings via :func:`parse`\ , or using the ``big`` string literal. .. doctest:: - julia> BigFloat(2.1) - 2.100000000000000088817841970012523233890533447265625000000000000000000000000000 + julia> BigFloat(2.1) + 2.100000000000000088817841970012523233890533447265625000000000000000000000000000 - julia> big"2.1" - 2.099999999999999999999999999999999999999999999999999999999999999999999999999986 + julia> big"2.1" + 2.099999999999999999999999999999999999999999999999999999999999999999999999999986 .. function:: rounding(T) .. Docstring generated from Julia source - Get the current floating point rounding mode for type ``T``, controlling - the rounding of basic arithmetic functions (:func:`+`, :func:`-`, - :func:`*`, :func:`/` and :func:`sqrt`) and type conversion. + Get the current floating point rounding mode for type ``T``\ , controlling the rounding of basic arithmetic functions (:func:`+`\ , :func:`-`\ , :func:`*`\ , :func:`/` and :func:`sqrt`\ ) and type conversion. - Valid modes are ``RoundNearest``, ``RoundToZero``, ``RoundUp``, - ``RoundDown``, and ``RoundFromZero`` (``BigFloat`` only). + Valid modes are ``RoundNearest``\ , ``RoundToZero``\ , ``RoundUp``\ , ``RoundDown``\ , and ``RoundFromZero`` (``BigFloat`` only). .. function:: setrounding(T, mode) .. Docstring generated from Julia source - Set the rounding mode of floating point type ``T``, controlling the - rounding of basic arithmetic functions (:func:`+`, :func:`-`, :func:`*`, - :func:`/` and :func:`sqrt`) and type conversion. + Set the rounding mode of floating point type ``T``\ , controlling the rounding of basic arithmetic functions (:func:`+`\ , :func:`-`\ , :func:`*`\ , :func:`/` and :func:`sqrt`\ ) and type conversion. - Note that this may affect other types, for instance changing the rounding - mode of ``Float64`` will change the rounding mode of ``Float32``. See - ``rounding`` for available modes + Note that this may affect other types, for instance changing the rounding mode of ``Float64`` will change the rounding mode of ``Float32``\ . See ``rounding`` for available modes .. function:: setrounding(f::Function, T, mode) @@ -608,7 +592,7 @@ As ``BigInt`` represents unbounded integers, the interval must be specified (e.g Pick a random element or array of random elements from the set of values specified by ``S``\ ; ``S`` can be * an indexable collection (for example ``1:n`` or ``['x','y','z']``\ ), or - * a type: the set of values to pick from is then equivalent to ``typemin(S):typemax(S)`` for integers (this is not applicable to ``BigInt``\ ), and to :math:`[0, 1)` for floating point numbers; + * a type: the set of values to pick from is then equivalent to ``typemin(S):typemax(S)`` for integers (this is not applicable to ``BigInt``\ ), and to :math:`[0, 1)` for floating point numbers; ``S`` defaults to ``Float64``\ . diff --git a/doc/stdlib/parallel.rst b/doc/stdlib/parallel.rst index 87541e38715ab..2ff552b707b86 100644 --- a/doc/stdlib/parallel.rst +++ b/doc/stdlib/parallel.rst @@ -147,8 +147,7 @@ General Parallel Computing Support .. Docstring generated from Julia source - Launches workers using the in-built ``LocalManager`` which only launches workers on the local host. - This can be used to take advantage of multiple cores. ``addprocs(4)`` will add 4 processes on the local machine. + Launches workers using the in-built ``LocalManager`` which only launches workers on the local host. This can be used to take advantage of multiple cores. ``addprocs(4)`` will add 4 processes on the local machine. .. function:: addprocs() -> List of process identifiers @@ -156,48 +155,43 @@ General Parallel Computing Support Equivalent to ``addprocs(CPU_CORES)`` - Note that workers do not run a ``.juliarc.jl`` startup script, nor do they synchronize their global state - (such as global variables, new method definitions, and loaded modules) with any of the other running processes. + Note that workers do not run a ``.juliarc.jl`` startup script, nor do they synchronize their global state (such as global variables, new method definitions, and loaded modules) with any of the other running processes. .. function:: addprocs(machines; tunnel=false, sshflags=``, max_parallel=10, exeflags=``) -> List of process identifiers .. Docstring generated from Julia source - Add processes on remote machines via SSH. - Requires julia to be installed in the same location on each node, or to be available via a shared file system. + Add processes on remote machines via SSH. Requires julia to be installed in the same location on each node, or to be available via a shared file system. ``machines`` is a vector of machine specifications. Worker are started for each specification. - A machine specification is either a string ``machine_spec`` or a tuple - ``(machine_spec, count)`` + A machine specification is either a string ``machine_spec`` or a tuple - ``(machine_spec, count)``\ . - ``machine_spec`` is a string of the form ``[user@]host[:port] [bind_addr[:port]]``. ``user`` defaults - to current user, ``port`` to the standard ssh port. If ``[bind_addr[:port]]`` is specified, other - workers will connect to this worker at the specified ``bind_addr`` and ``port``. - - ``count`` is the number of workers to be launched on the specified host. If specified as ``:auto`` - it will launch as many workers as the number of cores on the specific host. + ``machine_spec`` is a string of the form ``[user@]host[:port] [bind_addr[:port]]``\ . ``user`` defaults to current user, ``port`` to the standard ssh port. If ``[bind_addr[:port]]`` is specified, other workers will connect to this worker at the specified ``bind_addr`` and ``port``\ . + ``count`` is the number of workers to be launched on the specified host. If specified as ``:auto`` it will launch as many workers as the number of cores on the specific host. Keyword arguments: - ``tunnel`` : if ``true`` then SSH tunneling will be used to connect to the worker from the master process. + ``tunnel``\ : if ``true`` then SSH tunneling will be used to connect to the worker from the master process. + + ``sshflags``\ : specifies additional ssh options, e.g. + + .. code-block:: julia - ``sshflags`` : specifies additional ssh options, e.g. :literal:`sshflags=\`-i /home/foo/bar.pem\`` . + sshflags=`-i /home/foo/bar.pem` - ``max_parallel`` : specifies the maximum number of workers connected to in parallel at a host. Defaults to 10. + ``max_parallel``\ : specifies the maximum number of workers connected to in parallel at a host. Defaults to 10. - ``dir`` : specifies the working directory on the workers. Defaults to the host's current directory (as found by ``pwd()``) + ``dir``\ : specifies the working directory on the workers. Defaults to the host's current directory (as found by ``pwd()``\ ) - ``exename`` : name of the julia executable. Defaults to "$JULIA_HOME/julia" or "$JULIA_HOME/julia-debug" as the case may be. + ``exename``\ : name of the julia executable. Defaults to ``"$JULIA_HOME/julia"`` or ``"$JULIA_HOME/julia-debug"`` as the case may be. - ``exeflags`` : additional flags passed to the worker processes. + ``exeflags``\ : additional flags passed to the worker processes. Environment variables : - If the master process fails to establish a connection with a newly launched worker within 60.0 seconds, - the worker treats it a fatal situation and terminates. This timeout can be controlled via environment - variable ``JULIA_WORKER_TIMEOUT``. The value of ``JULIA_WORKER_TIMEOUT`` on the master process, specifies - the number of seconds a newly launched worker waits for connection establishment. + If the master process fails to establish a connection with a newly launched worker within 60.0 seconds, the worker treats it a fatal situation and terminates. This timeout can be controlled via environment variable ``JULIA_WORKER_TIMEOUT``\ . The value of ``JULIA_WORKER_TIMEOUT`` on the master process, specifies the number of seconds a newly launched worker waits for connection establishment. .. function:: addprocs(manager::ClusterManager; kwargs...) -> List of process identifiers @@ -205,10 +199,9 @@ General Parallel Computing Support Launches worker processes via the specified cluster manager. - For example Beowulf clusters are supported via a custom cluster manager implemented in package ``ClusterManagers``. + For example Beowulf clusters are supported via a custom cluster manager implemented in package ``ClusterManagers``\ . - The number of seconds a newly launched worker waits for connection establishment from the master can be - specified via variable ``JULIA_WORKER_TIMEOUT`` in the worker process's environment. Relevant only when using TCP/IP as transport. + The number of seconds a newly launched worker waits for connection establishment from the master can be specified via variable ``JULIA_WORKER_TIMEOUT`` in the worker process's environment. Relevant only when using TCP/IP as transport. .. function:: nprocs() @@ -256,13 +249,9 @@ General Parallel Computing Support .. Docstring generated from Julia source - Transform collections ``lsts`` by applying ``f`` to each element in parallel. - (Note that ``f`` must be made available to all worker processes; see :ref:`Code Availability and Loading Packages ` for details.) - If ``nprocs() > 1``, the calling process will be dedicated to assigning tasks. - All other available processes will be used as parallel workers, or on the processes specified by ``pids``. + Transform collections ``lsts`` by applying ``f`` to each element in parallel. (Note that ``f`` must be made available to all worker processes; see :ref:`Code Availability and Loading Packages ` for details.) If ``nprocs() > 1``\ , the calling process will be dedicated to assigning tasks. All other available processes will be used as parallel workers, or on the processes specified by ``pids``\ . - If ``err_retry`` is ``true``, it retries a failed application of ``f`` on a different worker. - If ``err_stop`` is ``true``, it takes precedence over the value of ``err_retry`` and ``pmap`` stops execution on the first error. + If ``err_retry`` is ``true``\ , it retries a failed application of ``f`` on a different worker. If ``err_stop`` is ``true``\ , it takes precedence over the value of ``err_retry`` and ``pmap`` stops execution on the first error. .. function:: remotecall(func, id, args...) @@ -312,8 +301,8 @@ General Parallel Computing Support * ``Future`` : Wait for a value to become available for the specified future. * ``Channel``\ : Wait for a value to be appended to the channel. * ``Condition``\ : Wait for ``notify`` on a condition. - * ``Process``\ : Wait for a process or process chain to exit. The ``exitcode`` field of a process can be used to determine success or failure. - * ``Task``\ : Wait for a ``Task`` to finish, returning its result value. If the task fails with an exception, the exception is propagated (re-thrown in the task that called ``wait``\ ). + * ``Process``\ : Wait for a process or process chain to exit. The ``exitcode`` field of a process can be used to determine success or failure. + * ``Task``\ : Wait for a ``Task`` to finish, returning its result value. If the task fails with an exception, the exception is propagated (re-thrown in the task that called ``wait``\ ). * ``RawFD``\ : Wait for changes on a file descriptor (see ``poll_fd`` for keyword arguments and return code) If no argument is passed, the task blocks for an undefined period. A task can only be restarted by an explicit call to ``schedule`` or ``yieldto``\ . @@ -326,8 +315,8 @@ General Parallel Computing Support Waits and fetches a value from ``x`` depending on the type of ``x``\ . Does not remove the item fetched: - * ``Future``\ : Wait for and get the value of a Future. The fetched value is cached locally. Further calls to ``fetch`` on the same reference return the cached value. If the remote value is an exception, throws a ``RemoteException`` which captures the remote exception and backtrace. - * ``RemoteChannel``\ : Wait for and get the value of a remote reference. Exceptions raised are same as for a ``Future`` . + * ``Future``\ : Wait for and get the value of a Future. The fetched value is cached locally. Further calls to ``fetch`` on the same reference return the cached value. If the remote value is an exception, throws a ``RemoteException`` which captures the remote exception and backtrace. + * ``RemoteChannel``\ : Wait for and get the value of a remote reference. Exceptions raised are same as for a ``Future`` . * ``Channel`` : Wait for and get the first available item from the channel. .. function:: remotecall_wait(func, id, args...) @@ -506,13 +495,13 @@ Shared Arrays .. Docstring generated from Julia source - Get the vector of processes that have mapped the shared array + Get the vector of processes that have mapped the shared array. .. function:: sdata(S::SharedArray) .. Docstring generated from Julia source - Returns the actual ``Array`` object backing ``S`` + Returns the actual ``Array`` object backing ``S``\ . .. function:: indexpids(S::SharedArray) @@ -538,15 +527,11 @@ between processes. It is possible for Cluster Managers to provide a different tr .. Docstring generated from Julia source - Implemented by cluster managers. It is called on the master process, during a worker's lifetime, - with appropriate ``op`` values: + Implemented by cluster managers. It is called on the master process, during a worker's lifetime, with appropriate ``op`` values: - - with ``:register``/``:deregister`` when a worker is added / removed - from the Julia worker pool. - - with ``:interrupt`` when ``interrupt(workers)`` is called. The - :class:`ClusterManager` should signal the appropriate worker with an - interrupt signal. - - with ``:finalize`` for cleanup purposes. + * with ``:register``\ /``:deregister`` when a worker is added / removed from the Julia worker pool. + * with ``:interrupt`` when ``interrupt(workers)`` is called. The :class:`ClusterManager` should signal the appropriate worker with an interrupt signal. + * with ``:finalize`` for cleanup purposes. .. function:: kill(manager::FooManager, pid::Int, config::WorkerConfig) diff --git a/doc/stdlib/pkg.rst b/doc/stdlib/pkg.rst index c1f6ed83cc633..09cc6c95f7104 100644 --- a/doc/stdlib/pkg.rst +++ b/doc/stdlib/pkg.rst @@ -67,7 +67,7 @@ Functions for package development (e.g. ``tag``, ``publish``, etc.) have been mo .. Docstring generated from Julia source - Set the protocol used to access GitHub-hosted packages. Defaults to 'https', with a blank ``proto`` delegating the choice to the package developer. + Set the protocol used to access GitHub-hosted packages. Defaults to 'https', with a blank ``proto`` delegating the choice to the package developer. .. function:: available() -> Vector{ASCIIString} diff --git a/doc/stdlib/profile.rst b/doc/stdlib/profile.rst index 4e55cea5351d9..cf357a162d9f4 100644 --- a/doc/stdlib/profile.rst +++ b/doc/stdlib/profile.rst @@ -28,22 +28,13 @@ The methods in :mod:`Base.Profile` are not exported and need to be called e.g. a .. Docstring generated from Julia source - Prints profiling results to ``io`` (by default, ``STDOUT``). If you - do not supply a ``data`` vector, the internal buffer of accumulated - backtraces will be used. ``format`` can be ``:tree`` or - ``:flat``. If ``C==true``, backtraces from C and Fortran code are - shown. ``combine==true`` merges instruction pointers that - correspond to the same line of code. ``cols`` controls the width - of the display. + Prints profiling results to ``io`` (by default, ``STDOUT``\ ). If you do not supply a ``data`` vector, the internal buffer of accumulated backtraces will be used. ``format`` can be ``:tree`` or ``:flat``\ . If ``C==true``\ , backtraces from C and Fortran code are shown. ``combine==true`` merges instruction pointers that correspond to the same line of code. ``cols`` controls the width of the display. .. function:: print([io::IO = STDOUT,] data::Vector, lidict::Dict; format = :tree, combine = true, cols = tty_cols()) .. Docstring generated from Julia source - Prints profiling results to ``io``. This variant is used to examine - results exported by a previous call to :func:`retrieve`. - Supply the vector ``data`` of backtraces and a dictionary - ``lidict`` of line information. + Prints profiling results to ``io``\ . This variant is used to examine results exported by a previous call to :func:`retrieve`\ . Supply the vector ``data`` of backtraces and a dictionary ``lidict`` of line information. .. function:: init(; n::Integer, delay::Float64) @@ -55,13 +46,7 @@ The methods in :mod:`Base.Profile` are not exported and need to be called e.g. a .. Docstring generated from Julia source - Returns a reference to the internal buffer of backtraces. Note that - subsequent operations, like :func:`clear`, can affect - ``data`` unless you first make a copy. Note that the values in - ``data`` have meaning only on this machine in the current session, - because it depends on the exact memory addresses used in - JIT-compiling. This function is primarily for internal use; - :func:`retrieve` may be a better choice for most users. + Returns a reference to the internal buffer of backtraces. Note that subsequent operations, like :func:`clear`\ , can affect ``data`` unless you first make a copy. Note that the values in ``data`` have meaning only on this machine in the current session, because it depends on the exact memory addresses used in JIT-compiling. This function is primarily for internal use; :func:`retrieve` may be a better choice for most users. .. function:: retrieve() -> data, lidict @@ -73,22 +58,11 @@ The methods in :mod:`Base.Profile` are not exported and need to be called e.g. a .. Docstring generated from Julia source - Given a previous profiling run, determine who called a particular - function. Supplying the filename (and optionally, range of line - numbers over which the function is defined) allows you to - disambiguate an overloaded method. The returned value is a vector - containing a count of the number of calls and line information - about the caller. One can optionally supply backtrace data - obtained from :func:`retrieve`; otherwise, the current internal profile - buffer is used. + Given a previous profiling run, determine who called a particular function. Supplying the filename (and optionally, range of line numbers over which the function is defined) allows you to disambiguate an overloaded method. The returned value is a vector containing a count of the number of calls and line information about the caller. One can optionally supply backtrace data obtained from :func:`retrieve`\ ; otherwise, the current internal profile buffer is used. .. function:: clear_malloc_data() .. Docstring generated from Julia source - Clears any stored memory allocation data when running julia with - ``--track-allocation``. Execute the command(s) you want to test - (to force JIT-compilation), then call :func:`clear_malloc_data`. - Then execute your command(s) again, quit Julia, and examine the - resulting ``*.mem`` files. + Clears any stored memory allocation data when running julia with ``--track-allocation``\ . Execute the command(s) you want to test (to force JIT-compilation), then call :func:`clear_malloc_data`\ . Then execute your command(s) again, quit Julia, and examine the resulting ``*.mem`` files. diff --git a/doc/stdlib/sort.rst b/doc/stdlib/sort.rst index 05d7fb308fe85..60ab3e1aa15be 100644 --- a/doc/stdlib/sort.rst +++ b/doc/stdlib/sort.rst @@ -138,24 +138,17 @@ Sorting Functions .. Docstring generated from Julia source - Return a permutation vector of indices of ``v`` that puts it in sorted order. - Specify ``alg`` to choose a particular sorting algorithm (see Sorting Algorithms). - ``MergeSort`` is used by default, and since it is stable, the resulting permutation - will be the lexicographically first one that puts the input array into sorted order – - i.e. indices of equal elements appear in ascending order. If you choose a non-stable - sorting algorithm such as ``QuickSort``, a different permutation that puts the array - into order may be returned. The order is specified using the same keywords as ``sort!``. + Return a permutation vector of indices of ``v`` that puts it in sorted order. Specify ``alg`` to choose a particular sorting algorithm (see Sorting Algorithms). ``MergeSort`` is used by default, and since it is stable, the resulting permutation will be the lexicographically first one that puts the input array into sorted order – i.e. indices of equal elements appear in ascending order. If you choose a non-stable sorting algorithm such as ``QuickSort``\ , a different permutation that puts the array into order may be returned. The order is specified using the same keywords as ``sort!``\ . - See also :func:`sortperm!` + See also :func:`sortperm!`\ . .. function:: sortperm!(ix, v, [alg=,] [by=,] [lt=,] [rev=false,] [initialized=false]) .. Docstring generated from Julia source - Like ``sortperm``, but accepts a preallocated index vector ``ix``. If ``initialized`` is ``false`` - (the default), ix is initialized to contain the values ``1:length(v)``. + Like ``sortperm``\ , but accepts a preallocated index vector ``ix``\ . If ``initialized`` is ``false`` (the default), ix is initialized to contain the values ``1:length(v)``\ . - See also :func:`sortperm` + See also :func:`sortperm`\ . .. function:: sortrows(A, [alg=,] [by=,] [lt=,] [rev=false]) diff --git a/doc/stdlib/strings.rst b/doc/stdlib/strings.rst index 50a0a00a2f646..49ee451e5904b 100644 --- a/doc/stdlib/strings.rst +++ b/doc/stdlib/strings.rst @@ -105,9 +105,9 @@ Construct a regex, such as ``r"^[a-z]*$"``\ . The regex also accepts one or more flags, listed after the ending quote, to change its behaviour: * ``i`` enables case-insensitive matching - * ``m`` treats the ``^`` and ``$`` tokens as matching the start and end of individual lines, as opposed to the whole string. + * ``m`` treats the ``^`` and ``$`` tokens as matching the start and end of individual lines, as opposed to the whole string. * ``s`` allows the ``.`` modifier to match newlines. - * ``x`` enables "comment mode": whitespace is enabled except when escaped with ``\``\ , and ``#`` is treated as starting a comment. + * ``x`` enables "comment mode": whitespace is enabled except when escaped with ``\``\ , and ``#`` is treated as starting a comment. For example, this regex has all three flags enabled: @@ -137,13 +137,13 @@ Alternatively, finer control and additional transformations may be be obtained by calling ``normalize_string(s; keywords...)``\ , where any number of the following boolean keywords options (which all default to ``false`` except for ``compose``\ ) are specified: * ``compose=false``\ : do not perform canonical composition - * ``decompose=true``\ : do canonical decomposition instead of canonical composition (``compose=true`` is ignored if present) + * ``decompose=true``\ : do canonical decomposition instead of canonical composition (``compose=true`` is ignored if present) * ``compat=true``\ : compatibility equivalents are canonicalized * ``casefold=true``\ : perform Unicode case folding, e.g. for case-insensitive string comparison - * ``newline2lf=true``\ , ``newline2ls=true``\ , or ``newline2ps=true``\ : convert various newline sequences (LF, CRLF, CR, NEL) into a linefeed (LF), line-separation (LS), or paragraph-separation (PS) character, respectively + * ``newline2lf=true``\ , ``newline2ls=true``\ , or ``newline2ps=true``\ : convert various newline sequences (LF, CRLF, CR, NEL) into a linefeed (LF), line-separation (LS), or paragraph-separation (PS) character, respectively * ``stripmark=true``\ : strip diacritical marks (e.g. accents) - * ``stripignore=true``\ : strip Unicode's "default ignorable" characters (e.g. the soft hyphen or the left-to-right marker) - * ``stripcc=true``\ : strip control characters; horizontal tabs and form feeds are converted to spaces; newlines are also converted to spaces unless a newline-conversion flag was specified + * ``stripignore=true``\ : strip Unicode's "default ignorable" characters (e.g. the soft hyphen or the left-to-right marker) + * ``stripcc=true``\ : strip control characters; horizontal tabs and form feeds are converted to spaces; newlines are also converted to spaces unless a newline-conversion flag was specified * ``rejectna=true``\ : throw an error if unassigned code points are found * ``stable=true``\ : enforce Unicode Versioning Stability @@ -171,7 +171,7 @@ .. Docstring generated from Julia source - Tells whether index ``i`` is valid for the given string + Tells whether index ``i`` is valid for the given string. .. function:: is_assigned_char(c) -> Bool @@ -253,7 +253,7 @@ .. Docstring generated from Julia source - Reverses a string + Reverses a string. .. function:: replace(string, pat, r[, n]) @@ -331,7 +331,11 @@ .. Docstring generated from Julia source - Join an array of ``strings`` into a single string, inserting the given delimiter between adjacent strings. If ``last`` is given, it will be used instead of ``delim`` between the last two strings. For example, ``join(["apples", "bananas", "pineapples"], ", ", " and ") == "apples, bananas and pineapples"``\ . + Join an array of ``strings`` into a single string, inserting the given delimiter between adjacent strings. If ``last`` is given, it will be used instead of ``delim`` between the last two strings. For example + + .. code-block:: julia + + join(["apples", "bananas", "pineapples"], ", ", " and ") == "apples, bananas and pineapples" ``strings`` can be any iterable over elements ``x`` which are convertible to strings via ``print(io::IOBuffer, x)``\ . @@ -375,9 +379,7 @@ .. Docstring generated from Julia source - Create a random ASCII string of length ``len``, consisting of upper- and - lower-case letters and the digits 0-9. The optional ``rng`` argument - specifies a random number generator, see :ref:`Random Numbers `. + Create a random ASCII string of length ``len``\ , consisting of upper- and lower-case letters and the digits 0-9. The optional ``rng`` argument specifies a random number generator, see :ref:`Random Numbers `\ . .. function:: charwidth(c) @@ -485,7 +487,7 @@ .. Docstring generated from Julia source - General unescaping of traditional C and Unicode escape sequences. Reverse of :func:`escape_string`. See also :func:`print_unescaped`. + General unescaping of traditional C and Unicode escape sequences. Reverse of :func:`escape_string`\ . See also :func:`print_unescaped`\ . .. function:: utf16(s)