Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JuliaLang/julia into jb/scheduler…
Browse files Browse the repository at this point in the history
…_update
  • Loading branch information
JeffBezanson committed Feb 11, 2014
2 parents abe48bb + 96466ea commit a9bb567
Show file tree
Hide file tree
Showing 11 changed files with 567 additions and 548 deletions.
8 changes: 8 additions & 0 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ build_datarootdir = $(build_prefix)/share
build_includedir = $(build_prefix)/include
build_sysconfdir = $(build_prefix)/etc


# This used for debian packaging, to conform to library layout guidelines
ifeq ($(MULTIARCH_INSTALL), 1)
MULTIARCH = $(shell gcc -print-multiarch)
Expand Down Expand Up @@ -244,6 +245,13 @@ private_libdir_rel = $(shell $(JULIAHOME)/contrib/relative_path.sh $(bindir) $(p
# if not absolute, then relative to the directory of the julia executable
JCFLAGS += "-DJL_SYSTEM_IMAGE_PATH=\"$(build_private_libdir_rel)/sys.ji\""

# On Windows, we want shared library files to end up in $(build_bindir), instead of $(build_libdir)
ifeq ($(OS),WINNT)
build_shlibdir = $(build_bindir)
else
build_shlibdir = $(build_libdir)
endif

ifeq (exists, $(shell [ -e $(JULIAHOME)/Make.user ] && echo exists ))
include $(JULIAHOME)/Make.user
endif
Expand Down
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ endif

debug release: | $(DIRS) $(build_datarootdir)/julia/base $(build_datarootdir)/julia/test $(build_datarootdir)/julia/doc $(build_datarootdir)/julia/examples $(build_sysconfdir)/julia/juliarc.jl
@$(MAKE) $(QUIET_MAKE) julia-$@
# If we're on windows, we want all .dll's that are in /lib to be in /bin
ifeq ($(OS),WINNT)
cp -a $(build_libdir)/*.$(SHLIB_EXT) $(build_bindir)/
endif
@export private_libdir=$(private_libdir) && \
$(MAKE) $(QUIET_MAKE) LD_LIBRARY_PATH=$(build_libdir):$(LD_LIBRARY_PATH) JULIA_EXECUTABLE="$(JULIA_EXECUTABLE_$@)" $(build_private_libdir)/sys.$(SHLIB_EXT)

Expand Down Expand Up @@ -77,7 +73,7 @@ $(build_private_libdir)/sys%o: $(build_private_libdir)/sys%bc
.PRECIOUS: $(build_private_libdir)/sys%o

$(build_private_libdir)/sys%$(SHLIB_EXT): $(build_private_libdir)/sys%o
$(CXX) -shared -fPIC -L$(build_private_libdir) -L$(build_libdir) -o $@ $< \
$(CXX) -shared -fPIC -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -o $@ $< \
$$([ $(OS) = Darwin ] && echo -Wl,-undefined,dynamic_lookup || echo -Wl,--unresolved-symbols,ignore-all ) \
$$([ $(OS) = WINNT ] && echo -ljulia -lssp)

Expand Down Expand Up @@ -338,10 +334,6 @@ distclean: cleanall
run-julia run-julia-debug run-julia-release run \
install dist source-dist git-submodules

ifeq ($(VERBOSE),1)
.SILENT:
endif

test: release
@$(MAKE) $(QUIET_MAKE) -C test default

Expand Down
45 changes: 24 additions & 21 deletions base/linalg/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,11 @@ end

isposdef(A::Union(Eigen,GeneralizedEigen)) = all(A.values .> 0)

function eigfact!{T<:BlasReal}(A::StridedMatrix{T}; balance::Symbol=:balance)
function eigfact!{T<:BlasReal}(A::StridedMatrix{T}; permute::Bool=true, scale::Bool=true)
n = size(A, 2)
n==0 && return Eigen(zeros(T, 0), zeros(T, 0, 0))
issym(A) && return eigfact!(Symmetric(A))
A, WR, WI, VL, VR, _ = LAPACK.geevx!(balance == :balance ? 'B' : (balance == :diagonal ? 'S' : (balance == :permute ? 'P' : (balance == :nobalance ? 'N' : throw(ArgumentError("balance must be either ':balance', ':diagonal', ':permute' or ':nobalance'"))))), 'N', 'V', 'N', A)
A, WR, WI, VL, VR, _ = LAPACK.geevx!(permute ? (scale ? 'B' : 'P') : (scale ? 'S' : 'N'), 'N', 'V', 'N', A)
all(WI .== 0.) && return Eigen(WR, VR)
evec = zeros(Complex{T}, n, n)
j = 1
Expand All @@ -657,45 +657,48 @@ function eigfact!{T<:BlasReal}(A::StridedMatrix{T}; balance::Symbol=:balance)
return Eigen(complex(WR, WI), evec)
end

function eigfact!{T<:BlasComplex}(A::StridedMatrix{T}; balance::Symbol=:balance)
function eigfact!{T<:BlasComplex}(A::StridedMatrix{T}; permute::Bool=true, scale::Bool=true)
n = size(A, 2)
n == 0 && return Eigen(zeros(T, 0), zeros(T, 0, 0))
ishermitian(A) && return eigfact!(Hermitian(A))
return Eigen(LAPACK.geevx!(balance == :balance ? 'B' : (balance == :diagonal ? 'S' : (balance == :permute ? 'P' : (balance == :nobalance ? 'N' : throw(ArgumentError("balance must be either ':balance', ':diagonal', ':permute' or ':nobalance'"))))), 'N', 'V', 'N', A)[[2,4]]...)
return Eigen(LAPACK.geevx!(permute ? (scale ? 'B' : 'P') : (scale ? 'S' : 'N'), 'N', 'V', 'N', A)[[2,4]]...)
end
eigfact{T<:BlasFloat}(A::StridedMatrix{T}; balance::Symbol=:balance) = eigfact!(copy(A), balance=balance)
eigfact{T}(A::StridedMatrix{T}; balance::Symbol=:balance) = (S = promote_type(Float32,typeof(one(T)/norm(one(T)))); S != T ? eigfact!(convert(Matrix{S}, A), balance=balance) : eigfact!(copy(A), balance=balance))
eigfact{T<:BlasFloat}(A::StridedMatrix{T}; kwargs...) = eigfact!(copy(A); kwargs...)
eigfact{T}(A::StridedMatrix{T}; kwargs...) = (S = promote_type(Float32,typeof(one(T)/norm(one(T)))); S != T ? eigfact!(convert(Matrix{S}, A); kwargs...) : eigfact!(copy(A); kwargs...))
eigfact(x::Number) = Eigen([x], fill(one(x), 1, 1))

function eig(A::Union(Number, AbstractMatrix), args...)
F = eigfact(A, args...)
# function eig(A::Union(Number, AbstractMatrix); permute::Bool=true, scale::Bool=true)
# F = eigfact(A, permute=permute, scale=scale)
# F[:values], F[:vectors]
# end
function eig(A::Union(Number, AbstractMatrix); kwargs...)
F = eigfact(A, kwargs...)
F[:values], F[:vectors]
end

#Calculates eigenvectors
eigvecs(A::Union(Number, AbstractMatrix); balance::Symbol=:balance) = eigfact(A, balance=balance)[:vectors]
eigvecs(A::Union(Number, AbstractMatrix); kwargs...) = eigfact(A; kwargs...)[:vectors]

function eigvals!{T<:BlasReal}(A::StridedMatrix{T})
function eigvals!{T<:BlasReal}(A::StridedMatrix{T}; permute::Bool=true, scale::Bool=true)
issym(A) && return eigvals!(Symmetric(A))
valsre, valsim, _, _ = LAPACK.geev!('N', 'N', A)
_, valsre, valsim, _ = LAPACK.geevx!(permute ? (scale ? 'B' : 'P') : (scale ? 'S' : 'N'), 'N', 'N', 'N', A)
return all(valsim .== 0) ? valsre : complex(valsre, valsim)
end
function eigvals!{T<:BlasComplex}(A::StridedMatrix{T})
function eigvals!{T<:BlasComplex}(A::StridedMatrix{T}; permute::Bool=true, scale::Bool=true)
ishermitian(A) && return eigvals(Hermitian(A))
return LAPACK.geev!('N', 'N', A)[1]
return LAPACK.geevx!(permute ? (scale ? 'B' : 'P') : (scale ? 'S' : 'N'), 'N', 'N', 'N', A)[2]
end
eigvals{T<:BlasFloat}(A::StridedMatrix{T}) = eigvals!(copy(A))
eigvals{T}(A::AbstractMatrix{T}) = (S = promote_type(Float32,typeof(one(T)/norm(one(T)))); S != T ? eigvals!(convert(Matrix{S}, A)) : eigvals!(copy(A)))
eigvals{T<:BlasFloat}(A::StridedMatrix{T}; kwargs...) = eigvals!(copy(A); kwargs...)
eigvals{T}(A::AbstractMatrix{T}; kwargs...) = (S = promote_type(Float32,typeof(one(T)/norm(one(T)))); S != T ? eigvals!(convert(Matrix{S}, A); kwargs...) : eigvals!(copy(A); kwargs...))

eigvals{T<:Number}(x::T) = (val = convert(promote_type(Float32,typeof(one(T)/norm(one(T)))),x); imag(val) == 0 ? [real(val)] : [val])
eigvals{T<:Number}(x::T; kwargs...) = (val = convert(promote_type(Float32,typeof(one(T)/norm(one(T)))),x); imag(val) == 0 ? [real(val)] : [val])

#Computes maximum and minimum eigenvalue
function eigmax(A::Union(Number, AbstractMatrix))
v = eigvals(A)
function eigmax(A::Union(Number, AbstractMatrix); kwargs...)
v = eigvals(A; kwargs...)
iseltype(v,Complex) ? error("DomainError: complex eigenvalues cannot be ordered") : maximum(v)
end
function eigmin(A::Union(Number, AbstractMatrix))
v = eigvals(A)
function eigmin(A::Union(Number, AbstractMatrix); kwargs...)
v = eigvals(A; kwargs...)
iseltype(v,Complex) ? error("DomainError: complex eigenvalues cannot be ordered") : minimum(v)
end

Expand Down
Loading

0 comments on commit a9bb567

Please sign in to comment.