Skip to content

Commit

Permalink
remove @swap!, add @inbounds
Browse files Browse the repository at this point in the history
	modified:   src/PermPlain.jl
	modified:   src/matrixops.jl
	deleted:    src/util.jl
  • Loading branch information
jlapeyre committed Apr 18, 2018
1 parent e3051ad commit 444f754
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/PermPlain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using DataStructures.counter
import Base: isperm, randperm

include("collect.jl")
include("util.jl")

export permlist, permcycles, permsparse, permmatrix # whether to export, and what ?

Expand Down Expand Up @@ -487,7 +486,7 @@ end

# Test if two permutations commute
function permcommute{T<:Real}(p::AbstractVector{T}, q::AbstractVector{T})
length(q) < length(p) ? @swap!(p,q) : nothing
length(q) < length(p) ? (p,q) = (q,p) : nothing
for i in length(p)
q[p[i]] == p[q[i]] || return false
end
Expand Down
4 changes: 2 additions & 2 deletions src/matrixops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
function permkron{T<:Real,S<:Real}(p::AbstractVector{T}, q::AbstractVector{S})
np = length(p); nq = length(q)
dc = Array{promote_type(T,S)}(np*nq)
for i in 1:np
for k in 1:nq
@inbounds for i in 1:np
@inbounds for k in 1:nq
dc[nq*(i-1) + k] = nq*(p[i]-1)+q[k]
end
end
Expand Down
11 changes: 0 additions & 11 deletions src/util.jl

This file was deleted.

0 comments on commit 444f754

Please sign in to comment.