Skip to content

Commit 4c9000d

Browse files
committed
delete _rand_pm1! in favor of rand!
1 parent e883d95 commit 4c9000d

File tree

4 files changed

+3
-14
lines changed

4 files changed

+3
-14
lines changed

base/sparse/linalg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ function normestinv(A::SparseMatrixCSC{T}, t::Integer = min(2,maximum(size(A))))
622622
X[1:n,1] = 1
623623
for j = 2:t
624624
while true
625-
_rand_pm1!(view(X,1:n,j))
625+
rand!(view(X,1:n,j), (-1, 1))
626626
yaux = X[1:n,j]' * X[1:n,1:j-1]
627627
if !_any_abs_eq(yaux,n)
628628
break
@@ -683,7 +683,7 @@ function normestinv(A::SparseMatrixCSC{T}, t::Integer = min(2,maximum(size(A))))
683683
end
684684
end
685685
if repeated
686-
_rand_pm1!(view(S,1:n,j))
686+
rand!(view(S,1:n,j), (-1, 1))
687687
else
688688
break
689689
end

base/sparse/sparse.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import Base: @get!, acos, acosd, acot, acotd, acsch, asech, asin, asind, asinh,
2727
vcat, hcat, hvcat, cat, imag, indmax, ishermitian, kron, length, log, log1p, max, min,
2828
maximum, minimum, norm, one, promote_eltype, real, reshape, rot180,
2929
rotl90, rotr90, round, scale!, setindex!, similar, size, transpose, tril,
30-
triu, vec, permute!, map, map!, Array, _rand_pm1!
30+
triu, vec, permute!, map, map!, Array
3131

3232
export AbstractSparseArray, AbstractSparseMatrix, AbstractSparseVector,
3333
SparseMatrixCSC, SparseVector, blkdiag, droptol!, dropzeros!, dropzeros,

base/sysimg.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,6 @@ include("pkg/pkg.jl")
441441

442442
# sparse matrices, vectors, and sparse linear algebra
443443

444-
function _rand_pm1! end # defined in Random
445-
446444
include("sparse/sparse.jl")
447445
using .SparseArrays
448446

stdlib/Random/src/sparse.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,3 @@ sprand(::Type{T}, n::Integer, p::AbstractFloat) where {T} = sprand(defaultRNG(),
144144

145145
sprandn(n::Integer, p::AbstractFloat) = sprand(defaultRNG(), n, p, randn)
146146
sprandn(r::AbstractRNG, n::Integer, p::AbstractFloat) = sprand(r, n, p, randn)
147-
148-
149-
## _rand_pm1! (used in Base.LinAlg)
150-
151-
function Base._rand_pm1!(v)
152-
for i in eachindex(v)
153-
v[i] = rand(Bool) ? 1 : -1
154-
end
155-
end

0 commit comments

Comments
 (0)