@@ -715,8 +715,8 @@ prod{T}(A::SparseMatrixCSC{T}, region) = reducedim(*,A,region,one(T))
715
715
function binarysearch (haystack:: AbstractVector , needle, lo:: Int , hi:: Int )
716
716
# Finds the first occurrence of needle in haystack[lo:hi]
717
717
lo = lo- 1
718
- hi2 = hi
719
718
hi = hi+ 1
719
+ hi2 = hi
720
720
@inbounds while lo < hi- 1
721
721
m = (lo+ hi)>>> 1
722
722
if haystack[m] < needle
@@ -725,7 +725,7 @@ function binarysearch(haystack::AbstractVector, needle, lo::Int, hi::Int)
725
725
hi = m
726
726
end
727
727
end
728
- (hi== hi2+ 1 || haystack[hi]!= needle) ? - 1 : hi
728
+ (hi== hi2 || haystack[hi]!= needle) ? - 1 : hi
729
729
end
730
730
function rangesearch (haystack:: Range , needle)
731
731
(i,rem) = divrem (needle - first (haystack), step (haystack))
@@ -737,7 +737,7 @@ getindex(A::SparseMatrixCSC, I::(Integer,Integer)) = getindex(A, I[1], I[2])
737
737
738
738
function getindex {T} (A:: SparseMatrixCSC{T} , i0:: Integer , i1:: Integer )
739
739
if ! (1 <= i0 <= A. m && 1 <= i1 <= A. n); throw (BoundsError ()); end
740
- ind = binarysearch (A. rowval, i0, A. colptr[i1], A. colptr[i1+ 1 ]- 1 )
740
+ ind = binarysearch (A. rowval, i0, int ( A. colptr[i1]) , A. colptr[i1+ 1 ]- 1 )
741
741
ind > - 1 ? A. nzval[ind] : zero (T)
742
742
end
743
743
@@ -1073,8 +1073,8 @@ function setindex!{T,Ti}(A::SparseMatrixCSC{T,Ti}, v, i0::Integer, i1::Integer)
1073
1073
i1 = convert (Ti, i1)
1074
1074
if ! (1 <= i0 <= A. m && 1 <= i1 <= A. n); throw (BoundsError ()); end
1075
1075
v = convert (T, v)
1076
- r1 = A. colptr[i1]
1077
- r2 = A. colptr[i1+ 1 ]- 1
1076
+ r1 = int ( A. colptr[i1])
1077
+ r2 = int ( A. colptr[i1+ 1 ]- 1 )
1078
1078
if v == 0 # either do nothing or delete entry if it exists
1079
1079
loc = binarysearch (A. rowval, i0, r1, r2)
1080
1080
if loc != - 1
@@ -1851,7 +1851,7 @@ done(d::SpDiagIterator, j) = j > d.n
1851
1851
1852
1852
function next {Tv} (d:: SpDiagIterator{Tv} , j)
1853
1853
A = d. A
1854
- idx = binarysearch (A. rowval, j, A. colptr[j], A. colptr[j+ 1 ]- 1 )
1854
+ idx = binarysearch (A. rowval, j, int ( A. colptr[j]) , A. colptr[j+ 1 ]- 1 )
1855
1855
((idx == - 1 ) ? zero (Tv) : A. nzval[idx], j+ 1 )
1856
1856
end
1857
1857
0 commit comments