From 51f2e8064f75250254e0d635309ea61bdd2cc5e2 Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Sun, 9 Oct 2016 15:44:33 -0700 Subject: [PATCH] Migrate full(X) to convert(Array, X) in tests outside of test/sparse and test/linalg. Migrate full to convert in some documentation. --- doc/manual/arrays.rst | 4 ++-- doc/stdlib/linalg.rst | 12 ++++++------ test/hashing.jl | 2 +- test/math.jl | 10 +++++----- test/perf/threads/stockcorr/pstockcorr.jl | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc/manual/arrays.rst b/doc/manual/arrays.rst index ba99ceb0419731..e50afc74038218 100644 --- a/doc/manual/arrays.rst +++ b/doc/manual/arrays.rst @@ -762,7 +762,7 @@ into a sparse matrix using the :func:`sparse` function: [4, 4] = 1.0 [5, 5] = 1.0 -You can go in the other direction using the :func:`full` function. The +You can go in the other direction using the :func:`convert` function. The :func:`issparse` function can be used to query if a matrix is sparse. .. doctest:: @@ -808,7 +808,7 @@ reference. +----------------------------------------+----------------------------------+--------------------------------------------+ | :func:`speye(n) ` | :func:`eye(n) ` | Creates a *n*-by-*n* identity matrix. | +----------------------------------------+----------------------------------+--------------------------------------------+ -| :func:`full(S) ` | :func:`sparse(A) ` | Interconverts between dense | +| :func:`Array(S) ` | :func:`sparse(A) ` | Interconverts between dense | | | | and sparse formats. | +----------------------------------------+----------------------------------+--------------------------------------------+ | :func:`sprand(m,n,d) ` | :func:`rand(m,n) ` | Creates a *m*-by-*n* random matrix (of | diff --git a/doc/stdlib/linalg.rst b/doc/stdlib/linalg.rst index 8bcf73ba34b9cb..28e313849b87ef 100644 --- a/doc/stdlib/linalg.rst +++ b/doc/stdlib/linalg.rst @@ -132,7 +132,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. 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`\ . ``ev``\ 's length must be one less than the length of ``dv``\ . + 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:`convert`\ . ``ev``\ 's length must be one less than the length of ``dv``\ . **Example** @@ -147,7 +147,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Constructs an upper (``uplo='U'``\ ) or lower (``uplo='L'``\ ) 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`\ . ``ev``\ 's length must be one less than the length of ``dv``\ . + Constructs an upper (``uplo='U'``\ ) or lower (``uplo='L'``\ ) 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:`convert`\ . ``ev``\ 's length must be one less than the length of ``dv``\ . **Example** @@ -176,13 +176,13 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Construct a symmetric tridiagonal matrix from the diagonal and first sub/super-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 symmetric tridiagonal matrix from the diagonal and first sub/super-diagonal, respectively. The result is of type ``SymTridiagonal`` and provides efficient specialized eigensolvers, but may be converted into a regular matrix with :func:`convert`\ . .. function:: Tridiagonal(dl, d, du) .. Docstring generated from Julia source - Construct a tridiagonal matrix from the first subdiagonal, diagonal, and first superdiagonal, respectively. The result is of type ``Tridiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`full`\ . The lengths of ``dl`` and ``du`` must be one less than the length of ``d``\ . + Construct a tridiagonal matrix from the first subdiagonal, diagonal, and first superdiagonal, respectively. The result is of type ``Tridiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`convert`\ . The lengths of ``dl`` and ``du`` must be one less than the length of ``d``\ . .. function:: Symmetric(A, uplo=:U) @@ -722,7 +722,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. 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:`convert`\ . .. function:: hessfact!(A) -> Hessenberg @@ -1175,7 +1175,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f .. Docstring generated from Julia source - Construct a tridiagonal matrix from the first subdiagonal, diagonal, and first superdiagonal, respectively. The result is of type ``Tridiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`full`\ . The lengths of ``dl`` and ``du`` must be one less than the length of ``d``\ . + Construct a tridiagonal matrix from the first subdiagonal, diagonal, and first superdiagonal, respectively. The result is of type ``Tridiagonal`` and provides efficient specialized linear solvers, but may be converted into a regular matrix with :func:`convert`\ . The lengths of ``dl`` and ``du`` must be one less than the length of ``d``\ . .. function:: rank(M[, tol::Real]) diff --git a/test/hashing.jl b/test/hashing.jl index 1919226f41d2a4..272c20a1d6172e 100644 --- a/test/hashing.jl +++ b/test/hashing.jl @@ -89,7 +89,7 @@ end x = sprand(10, 10, 0.5) x[1] = 1 x.nzval[1] = 0 -@test hash(x) == hash(full(x)) +@test hash(x) == hash(Array(x)) let a = QuoteNode(1), b = QuoteNode(1.0) @test (hash(a)==hash(b)) == (a==b) diff --git a/test/math.jl b/test/math.jl index af5212c43ff8b1..a736f98ef8e4c9 100644 --- a/test/math.jl +++ b/test/math.jl @@ -208,11 +208,11 @@ end TAA = rand(2,2) TAA = (TAA + TAA.')/2. STAA = Symmetric(TAA) - @test full(atanh.(STAA)) == atanh.(TAA) - @test full(asinh.(STAA)) == asinh.(TAA) - @test full(acosh.(STAA+Symmetric(ones(TAA)))) == acosh.(TAA+ones(TAA)) - @test full(acsch.(STAA+Symmetric(ones(TAA)))) == acsch.(TAA+ones(TAA)) - @test full(acoth.(STAA+Symmetric(ones(TAA)))) == acoth.(TAA+ones(TAA)) + @test Array(atanh.(STAA)) == atanh.(TAA) + @test Array(asinh.(STAA)) == asinh.(TAA) + @test Array(acosh.(STAA+Symmetric(ones(TAA)))) == acosh.(TAA+ones(TAA)) + @test Array(acsch.(STAA+Symmetric(ones(TAA)))) == acsch.(TAA+ones(TAA)) + @test Array(acoth.(STAA+Symmetric(ones(TAA)))) == acoth.(TAA+ones(TAA)) end @testset "check exp2(::Integer) matches exp2(::Float)" begin diff --git a/test/perf/threads/stockcorr/pstockcorr.jl b/test/perf/threads/stockcorr/pstockcorr.jl index 076feb7cc58b2f..068d979055e35b 100644 --- a/test/perf/threads/stockcorr/pstockcorr.jl +++ b/test/perf/threads/stockcorr/pstockcorr.jl @@ -78,7 +78,7 @@ function pstockcorr(n) SimulPriceB[1,:] = CurrentPrice[2] ## Generating the paths of stock prices by Geometric Brownian Motion - const UpperTriangle = full(chol(Corr)) # UpperTriangle Matrix by Cholesky decomposition + const UpperTriangle = Array(chol(Corr)) # UpperTriangle Matrix by Cholesky decomposition # Optimization: pre-allocate these for performance # NOTE: the new GC will hopefully fix this, but currently GC time