Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JuliaLang/julia
Browse files Browse the repository at this point in the history
Conflicts:
	base/Makefile
	base/export.jl
	base/pkg.jl
	base/sysimg.jl
	src/ccall.cpp
	src/gf.c
	test/Makefile
	test/file.jl
  • Loading branch information
vtjnash committed Dec 16, 2012
2 parents e201965 + 59a96c9 commit 92f86f1
Show file tree
Hide file tree
Showing 145 changed files with 4,997 additions and 104,641 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
*.creator
*.user
*.orig
*.swp

/usr
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ before_install:
- sudo add-apt-repository ppa:staticfloat/julia-deps -y
- sudo apt-get update -qq -y
- sudo apt-get install gfortran llvm-3.1-dev libsuitesparse-dev libncurses5-dev libopenblas-dev libarpack2-dev libfftw3-dev libpcre3-dev libglpk-dev lighttpd libgmp-dev libunwind7-dev libreadline-dev -y
script: make $BUILDOPTS PREFIX=/tmp/julia install
after_script:
script:
- make $BUILDOPTS PREFIX=/tmp/julia install
- cd .. && mv julia julia2
- cd /tmp/julia/share/julia/test && /tmp/julia/bin/julia runtests.jl all
- cd - && mv julia2 julia
Expand Down
17 changes: 12 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ Hi! Thanks for checking out Julia. If you have questions or problems, the [Julia

## Submitting your contributions

Julia now has a [package manager](https://github.com/JuliaLang/METADATA.jl). Most developers writing julia libraries are encouraged to provide them as a julia package. In case you are contributing to the core functionality or the base libraries, the process is as follows.

The Julia team uses [GitHub issues](https://github.com/JuliaLang/julia/issues) to track and discuss problems, feature requests, and pull requests.

You can make pull requests for incomplete features to get code review, in which case we have a convention of prefixing the pull request title with "RFC:" to indicate that the work is incomplete so it doesn't accidentally get merged into the master branch before it's ready.
You can make pull requests for incomplete features to get code review. The convention is to prefix the pull request title with "WIP:" or "RFC:" as appropriate to indicate that the work is incomplete, so that it is not accidentally merged.

Before submitting, make sure that all tests pass by running `make testall`. Even better, add your own tests for your change or feature to the test files in `test/`. If your contribution includes changes to Makefiles or external dependencies, make sure you can build Julia from a clean tree using `git clean -fdx` or equivalent (be careful – this command will delete any files lying around that aren't checked into git).
Before submitting, make sure that all tests pass by running `make testall`. Add your own tests for the new functionality in `test/`. If your contribution includes changes to Makefiles or external dependencies, make sure you can build Julia from a clean tree using `git clean -fdx` or equivalent (be careful – this command will delete any files lying around that aren't checked into git). Make sure that [Travis](http:https://www.travis-ci.org) greenlights the pull request with a `Good to merge` message.

*By contributing code to Julia, you are agreeing to release it under the [MIT License](https://github.com/JuliaLang/julia/tree/master/LICENSE.md).*

Expand All @@ -29,9 +31,14 @@ While getting familiar with Julia, remember to check out [the docs](http:https://docs.
## Resources

* Julia
- [Julia](http:https://julialang.org)
- [Julia Manual and Library Guide](http:https://docs.julialang.org/en/latest/)
- [Julia dev list](https://groups.google.com/forum/?fromgroups#!forum/julia-dev)
- **Homepage:** <http:https://julialang.org>
- **Mailing lists:** <http:https://julialang.org/mailing_lists>
- **IRC:** <http:https://webchat.freenode.net/?channels=julia>
- **Source code:** <https://github.com/JuliaLang/julia>
- **Git clone URL:** <git:https://github.com/JuliaLang/julia.git>
- **Documentation:** <http:https://julialang.org/manual/>
* Design of Julia
- [Julia: A Fast Dynamic Language for Technical Computing](http:https://julialang.org/images/julia-dynamic-2012-tr.pdf)
* Working with Types
- [Some Type Patterns](https://github.com/JuliaLang/julia/wiki/Code-Patterns)
- [The Type Hierarchy](https://github.com/JuliaLang/julia/wiki/Types-Hierarchy)
Expand Down
2 changes: 1 addition & 1 deletion Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ JL_PRIVATE_LIBDIR = lib/julia
JL_LIBDIR = lib

# If we're on debian, default to arch-dependent library dirs
ifeq ($(USE_DEBIAN), 1)
ifeq ($(MULTIARCH_INSTALL), 1)
MULTIARCH = $(shell gcc -print-multiarch)
JL_PRIVATE_LIBDIR = lib/$(MULTIARCH)/julia
JL_LIBDIR = lib/$(MULTIARCH)/
Expand Down
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include $(JULIAHOME)/Make.inc
all: default
default: release

DIRS = $(BUILD)/bin $(BUILD)/$(JL_LIBDIR) $(BUILD)/$(JL_PRIVATE_LIBDIR) $(BUILD)/share/julia
DIRS = $(BUILD)/bin $(BUILD)/lib $(BUILD)/$(JL_PRIVATE_LIBDIR) $(BUILD)/share/julia

$(foreach dir,$(DIRS),$(eval $(call dir_target,$(dir))))
$(foreach link,extras base test doc examples ui,$(eval $(call symlink_target,$(link),$(BUILD)/share/julia)))
Expand All @@ -17,7 +17,7 @@ endif
debug release: | $(DIRS) $(BUILD)/share/julia/extras $(BUILD)/share/julia/base $(BUILD)/share/julia/test $(BUILD)/share/julia/doc $(BUILD)/share/julia/examples $(BUILD)/share/julia/ui
@$(MAKEs) julia-$@
@export JL_PRIVATE_LIBDIR=$(JL_PRIVATE_LIBDIR) && \
$(MAKEs) JULIA_EXECUTABLE=$(JULIA_EXECUTABLE_$@) $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji
$(MAKEs) LD_LIBRARY_PATH=$(BUILD)/lib JULIA_EXECUTABLE=$(JULIA_EXECUTABLE_$@) $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji

julia-debug julia-release:
@-git submodule update
Expand Down Expand Up @@ -47,17 +47,16 @@ JL_PRIVATE_LIBS = amd arpack cholmod colamd fftw3 fftw3f fftw3_threads \

PREFIX ?= julia-$(JULIA_COMMIT)
install: release
@$(MAKEs) -C test/unicode
@for subdir in "sbin" "bin" "etc" $(JL_LIBDIR) $(JL_PRIVATE_LIBDIR) "share/julia" ; do \
mkdir -p $(PREFIX)/$$subdir ; \
done
cp $(BUILD)/bin/*julia* $(PREFIX)/bin
cd $(PREFIX)/bin && ln -s julia-release-$(DEFAULT_REPL) julia
cd $(PREFIX)/bin && ln -sf julia-release-$(DEFAULT_REPL) julia
-for suffix in $(JL_LIBS) ; do \
cp -a $(BUILD)/lib/lib$${suffix}.* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
cp -a $(BUILD)/$(JL_LIBDIR)/lib$${suffix}*.$(SHLIB_EXT)* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
done
-for suffix in $(JL_PRIVATE_LIBS) ; do \
cp -a $(BUILD)/lib/lib$${suffix}.* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
cp -a $(BUILD)/lib/lib$${suffix}*.$(SHLIB_EXT)* $(PREFIX)/$(JL_PRIVATE_LIBDIR) ; \
done
# Copy system image
ifneq ($(OS), WINNT)
Expand All @@ -79,7 +78,7 @@ dist:
# -$(MAKE) -C deps clean-openblas
$(MAKE) install OPENBLAS_DYNAMIC_ARCH=1
ifeq ($(OS), Darwin)
-./contrib/fixup-libgfortran.sh $(PREFIX)/$(JL_LIBDIR) $(PREFIX)/$(JL_PRIVATE_LIBDIR)
-./contrib/fixup-libgfortran.sh $(PREFIX)/$(JL_PRIVATE_LIBDIR)
endif
tar zcvf julia-$(JULIA_COMMIT)-$(OS)-$(ARCH).tar.gz julia-$(JULIA_COMMIT)
rm -fr julia-$(JULIA_COMMIT)
Expand All @@ -92,7 +91,6 @@ clean: | $(CLEAN_TARGETS)
@$(MAKE) -C extras clean
@$(MAKE) -C src clean
@$(MAKE) -C ui clean
@$(MAKE) -C test/unicode clean
@for buildtype in "release" "debug" ; do \
for repltype in "basic" "readline"; do \
rm -f julia-$${buildtype}-$${repltype}; \
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(_) | (_) (_) | A fresh approach to technical computing
_ _ _| |_ __ _ |
| | | | | | |/ _` | | http:https://julialang.org
| | |_| | | | (_| | | julia-dev@googlegroups.com
| | |_| | | | (_| | | julia-users@googlegroups.com
_/ |\__'_|_|_|\__'_| | #julia on freenode
|__/ |

Expand All @@ -21,7 +21,8 @@ This is the GitHub repository of Julia source code, including instructions for c

- **Homepage:** <http:https://julialang.org>
- **Binaries:** <https://github.com/JuliaLang/julia/downloads>
- **Mailing list:** <http:https://groups.google.com/group/julia-users/>
- **Packages:** <https://github.com/JuliaLang/METADATA.jl>
- **Mailing lists:** <http:https://julialang.org/mailing_lists>
- **IRC:** <http:https://webchat.freenode.net/?channels=julia>
- **Source code:** <https://github.com/JuliaLang/julia>
- **Git clone URL:** <git:https://github.com/JuliaLang/julia.git>
Expand Down
1 change: 0 additions & 1 deletion base/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/pcre_h.jl
/errno_h.jl
os_detect.jl
/build_h.jl
/file_constants.jl
14 changes: 5 additions & 9 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@ include ../Make.inc

PCRE_CONST = 0x[0-9a-fA-F]+|[-+]?\s*[0-9]+

all: pcre_h.jl errno_h.jl os_detect.jl build_h.jl file_constants.jl
all: pcre_h.jl errno_h.jl build_h.jl file_constants.jl

pcre_h.jl:
$(QUIET_PERL) $(CC) -E -dM $(shell $(PCRE_CONFIG) --prefix)/include/pcre.h | perl -nle '/^\s*#define\s+PCRE_(\w*)\s*\(?($(PCRE_CONST))\)?\s*$$/ and print "const $$1 = int32($$2)"' | sort > $@

errno_h.jl:
$(QUIET_PERL) echo '#include "errno.h"' | $(CC) -E -dM - | perl -nle 'print "const $$1 = int32($$2)" if /^#define\s+(E\w+)\s+(\d+)\s*$$/' | sort > $@

os_detect.jl: ../src/os_detect.h
$(QUIET_PERL) $(CC) -E -P -DJULIA ../src/os_detect.h | perl -p -e 's/\\n/\n/g' > $@

file_constants.jl: ../src/file_constants.h
$(QUIET_PERL) ${CC} -E -P -DJULIA ../src/file_constants.h | perl -nle 'print "$$1" if /^(\s*const\s+[A-z_]+\s+=\s+[0-9A-z_]+\s*)$$/' > $@


build_h.jl: ../Make.inc
@echo "libblas_name = \"$(LIBBLASNAME)\"" > $@
@echo "liblapack_name = \"$(LIBLAPACKNAME)\"" >> $@
build_h.jl: ../Make.inc ../src/os_detect.h
$(QUIET_PERL) $(CC) -E -P -DJULIA ../src/os_detect.h | grep OS_NAME > $@
@echo "const libblas_name = \"$(LIBBLASNAME)\"" >> $@
@echo "const liblapack_name = \"$(LIBLAPACKNAME)\"" >> $@

clean:
rm -f *# *~
rm -f pcre_h.jl
rm -f errno_h.jl
rm -f os_detect.jl
rm -f build_h.jl
113 changes: 112 additions & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,75 @@ function trailingsize(A, n)
return s
end

## Bounds checking ##
function check_bounds(sz::Int, I::Integer)
if I < 1 || I > sz
throw(BoundsError())
end
end

function check_bounds(sz::Int, I::AbstractVector{Bool})
if length(I) > sz
throw(BoundsError())
end
end

function check_bounds{T<:Integer}(sz::Int, I::Ranges{T})
if min(I) < 1 || max(I) > sz
throw(BoundsError())
end
end

function check_bounds{T <: Integer}(sz::Int, I::AbstractVector{T})
for i in I
if i < 1 || i > sz
throw(BoundsError())
end
end
end

function check_bounds(A::AbstractVector, I::AbstractVector{Bool})
if !isequal(size(A), size(I)) throw(BoundsError()) end
end

function check_bounds(A::AbstractArray, I::AbstractVector{Bool})
if !isequal(size(A), size(I)) throw(BoundsError()) end
end

function check_bounds(A::AbstractArray, I::AbstractArray{Bool})
if !isequal(size(A), size(I)) throw(BoundsError()) end
end

check_bounds(A::AbstractVector, I::Indices) = check_bounds(length(A), I)

function check_bounds(A::AbstractMatrix, I::Indices, J::Indices)
check_bounds(size(A,1), I)
check_bounds(size(A,2), J)
end

function check_bounds(A::AbstractArray, I::Indices, J::Indices)
check_bounds(size(A,1), I)
sz = size(A,2)
for i = 3:ndims(A)
sz *= size(A, i) # TODO: sync. with decision on issue #1030
end
check_bounds(sz, J)
end

function check_bounds(A::AbstractArray, I::Indices...)
n = length(I)
if n > 0
for dim = 1:(n-1)
check_bounds(size(A,dim), I[dim])
end
sz = size(A,n)
for i = n+1:ndims(A)
sz *= size(A,i) # TODO: sync. with decision on issue #1030
end
check_bounds(sz, I[n])
end
end

## Constructors ##

# default arguments to similar()
Expand Down Expand Up @@ -810,7 +879,7 @@ function (!=)(A::AbstractArray, B::AbstractArray)
end

(<)(A::AbstractArray, B::AbstractArray) =
error("< not defined for arrays. Try .< or isless.")
error("Not defined. To compare arrays, try .< .> .<= .>= or isless.")

(==)(A::AbstractArray, B) = error("Not defined. Try .== or isequal.")

Expand Down Expand Up @@ -858,6 +927,48 @@ for (f, op) = ((:cumsum, :+), (:cumprod, :*) )
@eval ($f)(A::AbstractArray) = ($f)(A, 1)
end

for (f, op) = ((:cummin, :min), (:cummax, :max))
@eval function ($f)(v::AbstractVector)
n = length(v)
cur_val = v[1]
res = similar(v, n)
res[1] = cur_val
for i in 2:n
cur_val = ($op)(v[i], cur_val)
res[i] = cur_val
end
return res
end

@eval function ($f)(A::AbstractArray, axis::Integer)
dimsA = size(A)
ndimsA = ndims(A)
axis_size = dimsA[axis]
axis_stride = 1
for i = 1:(axis-1)
axis_stride *= size(A,i)
end

if axis_size <= 1
return A
end

B = similar(A)

for i = 1:length(A)
if div(i-1, axis_stride) % axis_size == 0
B[i] = A[i]
else
B[i] = ($op)(A[i], B[i-axis_stride])
end
end

return B
end

@eval ($f)(A::AbstractArray) = ($f)(A, 1)
end

## ipermute in terms of permute ##

function ipermute(A::AbstractArray,perm)
Expand Down
Loading

0 comments on commit 92f86f1

Please sign in to comment.