Skip to content

Commit

Permalink
Changed char-value indexing to int-based one to get around changes fo…
Browse files Browse the repository at this point in the history
…r julia 0.4
  • Loading branch information
robertfeldt committed Dec 28, 2015
1 parent 15d7748 commit 2723e8e
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/sais.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function getcounts(T,C,n,k)
C[i] = 0
end
for i = 1:n
C[T[i]+1] += 1
C[Int(T[i])+1] += 1
end
end

Expand Down Expand Up @@ -116,7 +116,7 @@ function sais(T, SA, fs, n, k, isbwt)
end
if 1 <= i
0 <= b && (SA[b+1] = j)
b = (B[c1+1] -= 1)
b = (B[Int(c1)+1] -= 1)
j = i-1
m += 1
c1 = c0
Expand Down Expand Up @@ -196,7 +196,7 @@ function sais(T, SA, fs, n, k, isbwt)
c1 = T[p+1]
while true
c0 = c1
q = B[c0+1]
q = B[Int(c0)+1]
while q < j
j -= 1
SA[j+1] = 0
Expand Down Expand Up @@ -230,16 +230,16 @@ function LMSsort(T, SA, C, B, n, k)
getbuckets(C,B,k,false)
j = n - 1
c1 = T[j+1]
b = B[c1+1]
b = B[Int(c1)+1]
j -= 1
SA[b+1] = T[j+1] < c1 ? ~j : j
b += 1
for i = 1:n
if 0 < (j = SA[i])
if (c0 = T[j+1]) != c1
B[c1+1] = b
B[Int(c1)+1] = b
c1 = c0
b = B[c1+1]
b = B[Int(c1)+1]
end
j -= 1
SA[b+1] = T[j+1] < c1 ? ~j : j
Expand All @@ -259,7 +259,7 @@ function LMSsort(T, SA, C, B, n, k)
if c0 != c1
B[c1+1] = b
c1 = c0
b = B[c1+1]
b = B[Int(c1)+1]
end
j -= 1
b -= 1
Expand Down Expand Up @@ -337,7 +337,7 @@ function induceSA(T,SA,C,B,n,k)
getbuckets(C,B,k,false)
j = n - 1
c1 = T[j+1]
b = B[c1+1]
b = B[Int(c1)+1]
SA[b+1] = 0 < j && T[j] < c1 ? ~j : j
b += 1
for i = 1:n
Expand All @@ -346,9 +346,9 @@ function induceSA(T,SA,C,B,n,k)
if 0 < j
j -= 1
if (c0 = T[j+1]) != c1
B[c1+1] = b
B[Int(c1)+1] = b
c1 = c0
b = B[c1+1]
b = B[Int(c1)+1]
end
SA[b+1] = 0 < j && T[j] < c1 ? ~j : j
b += 1
Expand All @@ -362,9 +362,9 @@ function induceSA(T,SA,C,B,n,k)
if 0 < (j = SA[i])
j -= 1
if (c0 = T[j+1]) != c1
B[c1+1] = b
B[Int(c1)+1] = b
c1 = c0
b = B[c1+1]
b = B[Int(c1)+1]
end
b -= 1
SA[b+1] = j == 0 || T[j] > c1 ? ~j : j
Expand All @@ -380,7 +380,7 @@ function computeBWT(T,SA,C,B,n,k)
getbuckets(C,B,k,false)
j = n-1
c1 = T[j+1]
b = B[c1+1]
b = B[Int(c1)+1]
SA[b+1] = 0 < j && T[j] < c1 ? ~j : j
b += 1
for i = 1:n
Expand All @@ -389,7 +389,7 @@ function computeBWT(T,SA,C,B,n,k)
c0 = T[j+1]
SA[i] = ~c0
if c0 != c1
B[c1+1] = b
B[Int(c1)+1] = b
c1 = c0
b = B[c1+1]
end
Expand All @@ -402,16 +402,16 @@ function computeBWT(T,SA,C,B,n,k)
C == B && getcounts(T,C,n,k)
getbuckets(C,B,k,true)
c1 = 0
b = B[c1+1]
b = B[Int(c1)+1]
for i = n:-1:1
if 0 < (j = SA[i])
j -= 1
c0 = T[j+1]
SA[i] = c0
if c0 != c1
B[c1+1] = b
B[Int(c1)+1] = b
c1 = c0
b = B[c1+1]
b = B[Int(c1)+1]
end
b -= 1
SA[b+1] = 0 < j && T[j] > c1 ? ~(T[j]) : j
Expand Down

0 comments on commit 2723e8e

Please sign in to comment.