Skip to content

Commit

Permalink
fix many generated functions definition ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Sep 28, 2016
1 parent 22fc969 commit f532395
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 204 deletions.
25 changes: 0 additions & 25 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

## Type aliases for convenience ##

typealias AbstractVector{T} AbstractArray{T,1}
typealias AbstractMatrix{T} AbstractArray{T,2}
typealias AbstractVecOrMat{T} Union{AbstractVector{T}, AbstractMatrix{T}}
typealias RangeIndex Union{Int, Range{Int}, AbstractUnitRange{Int}, Colon}
typealias DimOrInd Union{Integer, AbstractUnitRange}
typealias IntOrInd Union{Int, AbstractUnitRange}
typealias DimsOrInds{N} NTuple{N,DimOrInd}
typealias NeedsShaping Union{Tuple{Integer,Vararg{Integer}}, Tuple{OneTo,Vararg{OneTo}}}

macro _inline_pure_meta()
Expr(:meta, :inline, :pure)
end

## Basic functions ##

vect() = Array{Any,1}(0)
vect{T}(X::T...) = T[ X[i] for i=1:length(X) ]

function vect(X...)
T = promote_typeof(X...)
#T[ X[i] for i=1:length(X) ]
# TODO: this is currently much faster. should figure out why. not clear.
copy!(Array{T,1}(length(X)), X)
end

"""
size(A::AbstractArray, [dim...])
Expand Down
21 changes: 21 additions & 0 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## array.jl: Dense arrays

## Type aliases for convenience ##

typealias AbstractVector{T} AbstractArray{T,1}
typealias AbstractMatrix{T} AbstractArray{T,2}
typealias AbstractVecOrMat{T} Union{AbstractVector{T}, AbstractMatrix{T}}
typealias RangeIndex Union{Int, Range{Int}, AbstractUnitRange{Int}, Colon}
typealias DimOrInd Union{Integer, AbstractUnitRange}
typealias IntOrInd Union{Int, AbstractUnitRange}
typealias DimsOrInds{N} NTuple{N,DimOrInd}
typealias NeedsShaping Union{Tuple{Integer,Vararg{Integer}}, Tuple{OneTo,Vararg{OneTo}}}

typealias Vector{T} Array{T,1}
typealias Matrix{T} Array{T,2}
typealias VecOrMat{T} Union{Vector{T}, Matrix{T}}
Expand All @@ -14,6 +25,16 @@ typealias DenseVecOrMat{T} Union{DenseVector{T}, DenseMatrix{T}}

import Core: arraysize, arrayset, arrayref

vect() = Array{Any,1}(0)
vect{T}(X::T...) = T[ X[i] for i=1:length(X) ]

function vect(X...)
T = promote_typeof(X...)
#T[ X[i] for i=1:length(X) ]
# TODO: this is currently much faster. should figure out why. not clear.
return copy!(Array{T,1}(length(X)), X)
end

size(a::Array, d) = arraysize(a, d)
size(a::Vector) = (arraysize(a,1),)
size(a::Matrix) = (arraysize(a,1), arraysize(a,2))
Expand Down
2 changes: 1 addition & 1 deletion base/coreimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ if !isdefined(Main, :Base)
end

# core array operations
include("abstractarray.jl")
include("array.jl")
include("abstractarray.jl")

#TODO: eliminate Dict from inference
include("hashing.jl")
Expand Down
Loading

0 comments on commit f532395

Please sign in to comment.