~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to base/abstractarray.jl

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-11-17 19:32:52 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20131117193252-tkrpclguqqebqa35
Tags: 0.2.0+dfsg-3
testsuite-i386.patch: loosen the numerical precision for yet another test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1031
1031
## Reductions and scans ##
1032
1032
 
1033
1033
function isequal(A::AbstractArray, B::AbstractArray)
 
1034
    if A === B return true end
1034
1035
    if size(A) != size(B)
1035
1036
        return false
1036
1037
    end
1309
1310
indices(I::Int) = I
1310
1311
indices(I::Real) = convert(Int, I)
1311
1312
indices(I::AbstractArray{Bool,1}) = find(I)
 
1313
indices(I::(Any,))            = (indices(I[1]), )
 
1314
indices(I::(Any,Any,))        = (indices(I[1]), indices(I[2]))
 
1315
indices(I::(Any,Any,Any))     = (indices(I[1]), indices(I[2]), indices(I[3]))
 
1316
indices(I::(Any,Any,Any,Any)) = (indices(I[1]), indices(I[2]), indices(I[3]), indices(I[4]))
1312
1317
indices(I::Tuple) = map(indices, I)
1313
1318
 
1314
1319
# Generalized repmat
1453
1458
prod(A::AbstractArray{Bool}, region) =
1454
1459
    error("use all() instead of prod() for boolean arrays")
1455
1460
 
1456
 
# Pairwise (cascade) summation of A[i1:i1+n-1], which O(log n) error growth
 
1461
# Pairwise (cascade) summation of A[i1:i1+n-1], which has O(log n) error growth
1457
1462
# [vs O(n) for a simple loop] with negligible performance cost if
1458
1463
# the base case is large enough.  See, e.g.:
1459
1464
#        http://en.wikipedia.org/wiki/Pairwise_summation