Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/JuliaLang/julia
Browse files Browse the repository at this point in the history
Conflicts:
	doc/stdlib/base.rst
  • Loading branch information
dirk committed Feb 12, 2013
2 parents 1fe29a3 + fee8e6d commit 8f33736
Show file tree
Hide file tree
Showing 283 changed files with 5,096 additions and 26,114 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "deps/nginx"]
path = deps/nginx
url = git://github.com/git-mirror/nginx
[submodule "deps/Rmath"]
path = deps/Rmath
url = git://github.com/JuliaLang/Rmath.git
1 change: 0 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ External libraries, if used, include their own licenses:
- [FADDEEVA](http://ab-initio.mit.edu/Faddeeva)
- [FEMTOLISP](https://github.com/JeffBezanson/femtolisp)
- [FFTW](http://fftw.org/doc/License-and-Copyright.html)
- [GLPK](http://www.gnu.org/software/glpk)
- [GMP](http://gmplib.org/manual/Copying.html#Copying)
- [LAPACK](http://netlib.org/lapack/LICENSE.txt)
- [LIBUNWIND](http://git.savannah.gnu.org/gitweb/?p=libunwind.git;a=blob_plain;f=LICENSE;hb=master)
Expand Down
16 changes: 12 additions & 4 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ USECLANG = 0
endif

ifeq ($(OS), Darwin)
OSVER = $(shell uname -r | cut -b 1-2)
ifeq ($(OSVER), 10)
DARWINVER = $(shell uname -r | cut -b 1-2)
OSXVER = $(shell sw_vers -productVersion | cut -b 1-4)
ifeq ($(DARWINVER), 10)
USEGCC = 1
USECLANG = 0
else
Expand Down Expand Up @@ -154,7 +155,6 @@ USE_SYSTEM_FFTW=0
USE_SYSTEM_GMP=0
USE_SYSTEM_ARPACK=0
USE_SYSTEM_SUITESPARSE=0
USE_SYSTEM_GLPK=0
USE_SYSTEM_LIGHTTPD=0
USE_SYSTEM_NGINX=0
USE_SYSTEM_ZLIB=0
Expand All @@ -163,6 +163,15 @@ ifeq (exists, $(shell [ -e $(JULIAHOME)/Make.user ] && echo exists ))
include $(JULIAHOME)/Make.user
endif

# Snow Leopard specific configuration
ifeq ($(OS), Darwin)
ifeq ($(OSXVER), 10.6)
USE_SYSTEM_LIBM = 1
USE_SYSTEM_BLAS = 1
USE_SYSTEM_LAPACK = 1
endif
endif

# ===========================================================================

ifeq ($(USE_SYSTEM_LIBUNWIND), 1)
Expand Down Expand Up @@ -373,7 +382,6 @@ else
JULIA_EXECUTABLE = $(JULIAHOME)/julia
endif


# Colors for make
ifndef USE_QUIET
USE_QUIET = 1
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ JL_LIBS = julia-release julia-debug

# private libraries, that are installed in $(PREFIX)/lib/julia
JL_PRIVATE_LIBS = amd arpack cholmod colamd fftw3 fftw3f fftw3_threads \
fftw3f_threads glpk glpk_wrapper gmp gmp_wrapper grisu \
fftw3f_threads glpk glpk_wrapper gmp grisu \
history openlibm openlibm-extras pcre \
random readline Rmath spqr suitesparse_wrapper \
tk_wrapper umfpack z openblas
Expand Down Expand Up @@ -138,7 +138,9 @@ test-%: release
@$(MAKE) $(QUIET_MAKE) -C test $*

webrepl: all
ifeq ($(USE_SYSTEM_NGINX), 0)
@$(MAKE) $(QUIET_MAKE) -C deps install-nginx
endif
@$(MAKE) -C ui/webserver julia-release

tk:
Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ First, acquire the source code by cloning the git repository:

git clone git://github.com/JuliaLang/julia.git

If you are behind a firewall and you need to use the https protocol instead of the git protocol:

git config --global url."https://".insteadOf git://

Next, enter the `julia/` directory and run `make` to build the `julia` executable. To perform a parallel build, use `make -j N` and supply the maximum number of concurrent processes.
When compiled the first time, it will automatically download and build its [external dependencies](#Required-Build-Tools-External-Libraries).
This takes a while, but only has to be done once.
This takes a while, but only has to be done once. If the defaults in the build do not work for you, and you need to set specific make parameters, you can save them in `Make.user`. The build will automatically check for the existence of `Make.user` and use it if it exists.
Building julia requires 1.5GiB of diskspace and approximately 700MiB of virtual memory.

**Note:** the build process will not work if any of the build directory's parent directories have spaces in their names (this is due to a limitation in GNU make).
Expand Down Expand Up @@ -85,21 +89,17 @@ GCC version 4.6 or later is recommended to build julia.

If the build fails trying to compile OpenBLAS, set OPENBLAS_TARGET_ARCH to BARCELONA on AMD, or NEHALEM on Intel CPUs in Make.inc and build again.

On some Linux distributions you may need to change how the readline library is linked. If you get a build error involving readline, try changing the value of `USE_SYSTEM_READLINE` in `Make.inc` to `1`.
On some Linux distributions you may need to change how the readline library is linked. If you get a build error involving readline, set `USE_SYSTEM_READLINE=1` in `Make.user`.

On Ubuntu systems, you may also need to install the package `libncurses5-dev`.

On CentOS 5 systems, the default compiler (gcc 4.1) is too old to build julia.

#### OS X

It is essential to use a 64-bit gfortran. Download and install [gfortran and gcc from hpc.sf.net](http://hpc.sf.net/), if necessary. The HPC gfortran requires gcc to function properly.

If you get link errors mentioning `gfortran`, it might help to put `/usr/local/gfortran/lib` at the beginning of the `DYLD_LIBRARY_PATH` environment variable.

Clang is now used by default to build julia on OS X (10.7 and above). Make sure to update to at least Xcode 4.3.3, and update to the latest command line tools from the Xcode preferences. This will ensure that clang v3.1 is installed, which is the minimum version of clang required to build julia.
It is essential to use a 64-bit gfortran to compile Julia dependencies. The gfortran-4.7 compilers in brew and macports work for building julia. If you do not use brew or macports, you can download and install [gfortran and gcc from hpc.sf.net](http://hpc.sf.net/). The HPC gfortran requires gcc to function properly.

If you are building on a 32-bit Mac or on Snow Leopard, it may have trouble building openlibm. In such a case, use `make USE_SYSTEM_LIBM=1`. If you run into trouble building openblas, try `make USE_SYSTEM_BLAS=1 USE_SYSTEM_LAPACK=1`. These settings can even be saved in `Make.user` so that you do not have to provide them every time you compile.
Clang is now used by default to build julia on OS X (10.7 and above). Make sure to update to at least Xcode 4.3.3, and update to the latest command line tools from the Xcode preferences. This will ensure that clang v3.1 is installed, which is the minimum version of clang required to build julia. On older systems, the julia build will attempt to use gcc. The build also detects Snow Leopard and sets `USE_SYSTEM_LIBM=1`, `USE_SYSTEM_BLAS=1`, and `USE_SYSTEM_LAPACK=1`.

#### FreeBSD

Expand Down Expand Up @@ -153,7 +153,6 @@ Julia uses the following external libraries, which are automatically downloaded
- **[GMP]** — the GNU multiple precision arithmetic library, needed for bigint support.
- **[D3]** — JavaScript visualization library.
- **[double-conversion]** — efficient number-to-text conversion.
- **[GLPK]** — linear programming.
- **[Rmath]** — basic RNGs and distributions.


Expand Down Expand Up @@ -182,11 +181,10 @@ Julia uses the following external libraries, which are automatically downloaded
[GMP]: http://gmplib.org/
[D3]: http://mbostock.github.com/d3/
[double-conversion]: http://double-conversion.googlecode.com/
[GLPK]: http://www.gnu.org/software/glpk/
[Rmath]: http://cran.r-project.org/doc/manuals/R-admin.html#The-standalone-Rmath-library
[libuv]: https://github.com/JuliaLang/libuv

If you already have one or more of these packages installed on your system, it is possible to pass `USE_SYSTEM_...=1` to `make` to prevent Julia from compiling duplicates of these libraries. The complete list of possible flags can be found in Make.inc (or pass `USE_DEBIAN=1` to make if you have all build dependencies and want the minimal Julia build). Please be aware that this proceedure is not officially supported, as it introduces additional variablity into the installation and versioning of the dependencies, and is recommended only for system package maintainers. Unexpected compile errors may result, as the build system will do no further checking to ensure the proper packages are installed.
If you already have one or more of these packages installed on your system, it is possible to pass `USE_SYSTEM_...=1` to `make` to prevent Julia from compiling duplicates of these libraries. The complete list of possible flags can be found in Make.inc. Please be aware that this procedure is not officially supported, as it introduces additional variablity into the installation and versioning of the dependencies, and is recommended only for system package maintainers. Unexpected compile errors may result, as the build system will do no further checking to ensure the proper packages are installed.

SuiteSparse is a special case, since it is typically only installed as a static library, while `USE_SYSTEM_SUITESPARSE=1` requires that it is a shared library. Running the script `contrib/repackage_system_suitesparse4.make` will copy your static system SuiteSparse installation into the shared library format required by Julia.

Expand All @@ -198,10 +196,10 @@ SuiteSparse is a special case, since it is typically only installed as a static
deps/ external dependencies
examples/ example Julia programs
extras/ useful optional libraries
lib/ shared libraries loaded by Julia's standard libraries
src/ source for Julia language core
test/ unit and functional test cases
ui/ source for various front ends
usr/ binaries and shared libraries loaded by Julia's standard libraries

<a name="Binary-Installation"/>
## Binary Installation
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0
0.1
2 changes: 2 additions & 0 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ clean:
rm -f pcre_h.jl
rm -f errno_h.jl
rm -f build_h.jl
rm -f uv_constants.jl
rm -f file_constants.jl
42 changes: 20 additions & 22 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## abstractarray.jl : Generic array interfaces.

## Type aliases for convenience ##

typealias AbstractVector{T} AbstractArray{T,1}
Expand Down Expand Up @@ -142,24 +140,24 @@ function reshape(a::AbstractArray, dims::Dims)
error("reshape: invalid dimensions")
end
b = similar(a, dims)
for i=1:length(a)
for i = 1:length(a)
b[i] = a[i]
end
return b
end
reshape(a::AbstractArray, dims::Int...) = reshape(a, dims)

vec(a::AbstractArray) = reshape(a,max(size(a)))
vec(a::AbstractArray) = reshape(a,length(a))

function squeeze(A::AbstractArray)
if length(A) == 1
d = (1,)
else
d = ()
for i in size(A)
if i != 1
d = tuple(d..., i)
function squeeze(A::AbstractArray, dims)
d = ()
for i in 1:ndims(A)
if contains(dims,i)
if size(A,i) != 1
error("squeezed dims must all be size 1")
end
else
d = tuple(d..., size(A,i))
end
end
reshape(A, d)
Expand All @@ -172,7 +170,7 @@ function fill!(A::AbstractArray, x)
return A
end

function copy_to(dest::AbstractArray, src)
function copy!(dest::AbstractArray, src)
i = 1
for x in src
dest[i] = x
Expand All @@ -181,7 +179,7 @@ function copy_to(dest::AbstractArray, src)
return dest
end

copy(a::AbstractArray) = copy_to(similar(a), a)
copy(a::AbstractArray) = copy!(similar(a), a)
copy(a::AbstractArray{None}) = a # cannot be assigned into so is immutable

zero{T}(x::AbstractArray{T}) = fill!(similar(x), zero(T))
Expand Down Expand Up @@ -219,14 +217,14 @@ for (f,t) in ((:char, Char),
end

bool(x::AbstractArray{Bool}) = x
bool(x::AbstractArray) = copy_to(similar(x,Bool), x)
bool(x::AbstractArray) = copy!(similar(x,Bool), x)

for (f,t) in ((:float32, Float32),
(:float64, Float64),
(:complex64, Complex64),
(:complex128, Complex128))
@eval ($f)(x::AbstractArray{$t}) = x
@eval ($f)(x::AbstractArray) = copy_to(similar(x,$t), x)
@eval ($f)(x::AbstractArray) = copy!(similar(x,$t), x)
end

integer{T<:Integer}(x::AbstractArray{T}) = x
Expand All @@ -236,8 +234,8 @@ complex{T<:Complex}(x::AbstractArray{T}) = x

integer (x::AbstractArray) = iround_to(similar(x,typeof(integer(one(eltype(x))))), x)
unsigned(x::AbstractArray) = iround_to(similar(x,typeof(unsigned(one(eltype(x))))), x)
float (x::AbstractArray) = copy_to(similar(x,typeof(float(one(eltype(x))))), x)
complex (x::AbstractArray) = copy_to(similar(x,typeof(complex(one(eltype(x))))), x)
float (x::AbstractArray) = copy!(similar(x,typeof(float(one(eltype(x))))), x)
complex (x::AbstractArray) = copy!(similar(x,typeof(complex(one(eltype(x))))), x)

dense(x::AbstractArray) = x
full(x::AbstractArray) = x
Expand Down Expand Up @@ -574,7 +572,7 @@ function hcat{T}(A::Union(AbstractMatrix{T},AbstractVector{T})...)
for k=1:nargs
Ak = A[k]
n = length(Ak)
copy_to(B, pos, Ak, 1, n)
copy!(B, pos, Ak, 1, n)
pos += n
end
else
Expand Down Expand Up @@ -963,14 +961,14 @@ for (f, op) = ((:cummin, :min), (:cummax, :max))
@eval ($f)(A::AbstractArray) = ($f)(A, 1)
end

## ipermute in terms of permute ##
## ipermutedims in terms of permutedims ##

function ipermute(A::AbstractArray,perm)
function ipermutedims(A::AbstractArray,perm)
iperm = Array(Int,length(perm))
for i = 1:length(perm)
iperm[perm[i]] = i
end
return permute(A,iperm)
return permutedims(A,iperm)
end

## Other array functions ##
Expand Down
Loading

0 comments on commit 8f33736

Please sign in to comment.