diff --git a/src/array/subarray.jl b/src/array/subarray.jl index 8d866502..77a53a74 100644 --- a/src/array/subarray.jl +++ b/src/array/subarray.jl @@ -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) @@ -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) diff --git a/src/array/sumindex.jl b/src/array/sumindex.jl index cfb6895a..cbc7c002 100644 --- a/src/array/sumindex.jl +++ b/src/array/sumindex.jl @@ -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) @@ -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) @@ -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) diff --git a/src/problem/GoGame.jl b/src/problem/GoGame.jl index e8315aff..b04f0d7b 100644 --- a/src/problem/GoGame.jl +++ b/src/problem/GoGame.jl @@ -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 @@ -351,7 +351,7 @@ 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. @@ -359,7 +359,7 @@ function generate_move(board::Board, color::Int) (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 @@ -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) diff --git a/src/problem/Laplacian.jl b/src/problem/Laplacian.jl index 5aa64928..fb6b60aa 100644 --- a/src/problem/Laplacian.jl +++ b/src/problem/Laplacian.jl @@ -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) @@ -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 @@ -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 @@ -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) diff --git a/src/problem/SparseFEM.jl b/src/problem/SparseFEM.jl index 05c1aacb..c2395fa7 100644 --- a/src/problem/SparseFEM.jl +++ b/src/problem/SparseFEM.jl @@ -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 diff --git a/src/problem/StockCorr.jl b/src/problem/StockCorr.jl index 68c8feb5..ecaaca67 100644 --- a/src/problem/StockCorr.jl +++ b/src/problem/StockCorr.jl @@ -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