Skip to content

Revert #190 and anticipate deprecating implicit scalar broadcasting in setindex! #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/array/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ function perf_lucompletepivCopy!(A)
μ, λ = _maxind(As)
μ += k-1; λ += k-1
rowpiv[k] = μ
A[[k,μ], 1:n] .= A[[μ,k], 1:n]
A[[k,μ], 1:n] = A[[μ,k], 1:n]
colpiv[k] = λ
A[1:n, [k,λ]] .= A[1:n, [λ,k]]
A[1:n, [k,λ]] = A[1:n, [λ,k]]
if A[k,k] ≠ 0
ρ = k+1:n
A[ρ, k] ./= A[k, k]
A[ρ, ρ] .-= A[ρ, k:k] .* A[k:k, ρ]
A[ρ, k] = A[ρ, k]/A[k, k]
A[ρ, ρ] = A[ρ, ρ] - A[ρ, k:k] * A[k:k, ρ]
end
end
return (A, rowpiv, colpiv)
Expand All @@ -34,13 +34,13 @@ function perf_lucompletepivSub!(A)
μ, λ = _maxind(As)
μ += k-1; λ += k-1
rowpiv[k] = μ
A[[k,μ], 1:n] .= view(A, [μ,k], 1:n)
A[[k,μ], 1:n] = view(A, [μ,k], 1:n)
colpiv[k] = λ
A[1:n, [k,λ]] .= view(A, 1:n, [λ,k])
A[1:n, [k,λ]] = view(A, 1:n, [λ,k])
if A[k,k] ≠ 0
ρ = k+1:n
A[ρ, k] ./= A[k, k]
A[ρ, ρ] .-= view(A, ρ, k:k) .* view(A, k:k, ρ)
A[ρ, k] = view(A, ρ, k)/A[k, k]
A[ρ, ρ] = view(A, ρ, ρ) - view(A, ρ, k:k) * view(A, k:k, ρ)
end
end
return (A, rowpiv, colpiv)
Expand Down
6 changes: 3 additions & 3 deletions src/array/sumindex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function perf_sumlogical(A)
nrows = size(A, 1)
ncols = size(A, 2)
r = falses(nrows)
r[1:4:end] = true
r[1:4:end] .= true
@simd for i = 1:ncols
val = Base.unsafe_getindex(A, r, i)
s += first(val)
Expand Down Expand Up @@ -151,7 +151,7 @@ function perf_sumlogical_view(A)
nrows = size(A, 1)
ncols = size(A, 2)
r = falses(nrows)
r[1:4:end] = true
r[1:4:end] .= true
@inbounds for i = 1:ncols
val = view(A, r, i)
s += first(val)
Expand Down Expand Up @@ -287,7 +287,7 @@ end
function makearrays(::Type{T}, r::Integer, c::Integer) where T
A = samerand(T, r, c)
B = similar(A, r+1, c+1)
B[1:r, 1:c] .= A
B[1:r, 1:c] = A
AS = ArrayLS(B)
ASS = ArrayLSLS(B)
AF = ArrayLF(A)
Expand Down
8 changes: 4 additions & 4 deletions src/problem/GoGame.jl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ end
# that will not happen.
#
function compute_final_status!(board::Board)
board.final_status[:] = UNKNOWN
fill!(board.final_status, UNKNOWN)
for i = 1:board.size, j = 1:board.size
if board[i, j] == EMPTY
for k = 1:4
Expand Down Expand Up @@ -351,15 +351,15 @@ function generate_move(board::Board, color::Int)
# Further require the move not to be suicide for the opponent...
if !suicide(board, ai, aj, other_color(color))
num_moves += 1
moves[:,num_moves] .= (ai, aj)
moves[:,num_moves] = [ai, aj]
else
# ...however, if the move captures at least one stone,
# consider it anyway.
for k = 1:4
(bi, bj) = neighbor(ai, aj, k)
if on_board(board, bi, bj) && board[bi, bj] == other_color(color)
num_moves += 1
moves[:,num_moves] .= (ai, aj)
moves[:,num_moves] = [ai, aj]
break
end
end
Expand Down Expand Up @@ -415,7 +415,7 @@ function perf_go_game(num_games_per_point::Int)
passes = 0
num_moves = 1
color = WHITE
board.board[:] = EMPTY # clear board
fill!(board.board, EMPTY) # clear board
play_move!(board, i, j, BLACK)
while passes < 3 && num_moves < 600
(movei, movej) = generate_move(board, color)
Expand Down
8 changes: 4 additions & 4 deletions src/problem/Laplacian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function ddx_spdiags(m)
# Append new d[k]-th diagonal to compact form
for k = 1:p
i = max(1,1-d[k]):min(m,n-d[k])
a[(len[k]+1):len[k+1],:] .= [i i.+d[k] B[i.+(m>=n)*d[k],k]]
a[(len[k]+1):len[k+1],:] = [i i.+d[k] B[i.+(m>=n)*d[k],k]]
end

return sparse(a[:,1], a[:,2], a[:,3], m, n)
Expand Down Expand Up @@ -62,7 +62,7 @@ end

function perf_laplace_iter_devec(N)
u = zeros(N, N)
u[1, :] = 1
u[1, :] .= 1
Niter = 2^10
dx2 = 0.1*0.1
dy2 = dx2
Expand All @@ -80,7 +80,7 @@ end

function perf_laplace_iter_vec(N)
u = zeros(N, N)
u[1,:] = 1
u[1,:] .= 1
Niter = 2^10
dx2 = dy2 = 0.1*0.1
for i = 1:Niter
Expand All @@ -91,7 +91,7 @@ end

function perf_laplace_iter_sub(N)
u = zeros(N, N)
u[1,:] = 1
u[1,:] .= 1
Niter = 2^10
dx2 = dy2 = 0.1*0.1
u0 = view(u, 2:N-1, 2:N-1)
Expand Down
2 changes: 1 addition & 1 deletion src/problem/SparseFEM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end
# get the list of boundary dof-indices
function get_free(N)
L = zeros(Int, N, N)
L[2:N-1, 2:N-1] = 1
L[2:N-1, 2:N-1] .= 1
return findall(!iszero, L)
end

Expand Down
4 changes: 2 additions & 2 deletions src/problem/StockCorr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ function perf_stockcorr()

## Define storages
SimulPriceA = zeros(T,n) # Simulated Price of Asset A
SimulPriceA[1,:] = CurrentPrice[1]
SimulPriceA[1,:] .= CurrentPrice[1]
SimulPriceB = zeros(T,n) # Simulated Price of Asset B
SimulPriceB[1,:] = CurrentPrice[2]
SimulPriceB[1,:] .= CurrentPrice[2]

## Generating the paths of stock prices by Geometric Brownian Motion
UpperTriangle=chol(Corr) # UpperTriangle Matrix by Cholesky decomposition
Expand Down