Skip to content

Commit

Permalink
set type in cyc_pow_perm
Browse files Browse the repository at this point in the history
  • Loading branch information
jlapeyre committed Dec 13, 2014
1 parent c4f4fe4 commit 404eb72
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/PermPlain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ function permpower!{T<:Real}(p::AbstractVector{T},
end

# This does less allocation (in general) than permpower2.
# Depending on parameters, the time efficiency is the same to much better (4 times)
function permpower{T<:Real}(p::AbstractVector{T}, n::Integer)
n == 0 && return [one(T):convert(T,length(p))]
n == 1 && return copy(p) # for consistency, don't return ref
Expand Down Expand Up @@ -299,12 +298,11 @@ function cyc_pow_perm{T<:Real}(cyc::AbstractArray{Array{T,1},1}, exp::Integer)
n = 0
cmaxes = [maximum(c) for c in cyc]
n = maximum(cmaxes)
# This is for a cycles of length 1
# This routine assumes cycles of length 1 are included. Still don't understand it.
# for j = 1:length(cyc)
# n += length(cyc[j])+1
# end
# p = Array(Int,n)
p = [1:n] # wasteful
p = T[1:n] # wasteful
for j = 1:length(cyc)
v = cyc[j]
n = length(v)
Expand Down

0 comments on commit 404eb72

Please sign in to comment.