From 2d7b19d485941b64bd11a1775aab18ebc39741e0 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Fri, 3 Oct 2014 19:29:47 -0400 Subject: [PATCH 01/25] Loosen signature for some matmul functions as a prepartion for array views. --- base/linalg/matmul.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/base/linalg/matmul.jl b/base/linalg/matmul.jl index b3fa69f5182854..28c951c225ac52 100644 --- a/base/linalg/matmul.jl +++ b/base/linalg/matmul.jl @@ -4,9 +4,9 @@ arithtype(T) = T arithtype(::Type{Bool}) = Int # multiply by diagonal matrix as vector -function scale!(C::Matrix, A::Matrix, b::Vector) +function scale!(C::AbstractMatrix, A::AbstractMatrix, b::AbstractVector) m, n = size(A) - n==length(b) || throw(DimensionMismatch("")) + n == length(b) || throw(DimensionMismatch("")) for j = 1:n bj = b[j] for i = 1:m @@ -16,10 +16,10 @@ function scale!(C::Matrix, A::Matrix, b::Vector) C end -function scale!(C::Matrix, b::Vector, A::Matrix) +function scale!(C::AbstractMatrix, b::AbstractVector, A::AbstractMatrix) m, n = size(A) - m==length(b) || throw(DimensionMismatch("")) - for j=1:n, i=1:m + m == length(b) || throw(DimensionMismatch("")) + for j = 1:n, i = 1:m C[i,j] = A[i,j]*b[i] end C @@ -29,8 +29,8 @@ scale(b::Vector, A::Matrix) = scale!(similar(b, promote_type(eltype(A),eltype(b) # Dot products -dot{T<:BlasReal}(x::Vector{T}, y::Vector{T}) = BLAS.dot(x, y) -dot{T<:BlasComplex}(x::Vector{T}, y::Vector{T}) = BLAS.dotc(x, y) +dot{T<:BlasReal}(x::StridedVector{T}, y::StridedVector{T}) = BLAS.dot(x, y) +dot{T<:BlasComplex}(x::StridedVector{T}, y::StridedVector{T}) = BLAS.dotc(x, y) function dot{T<:BlasReal, TI<:Integer}(x::Vector{T}, rx::Union(UnitRange{TI},Range{TI}), y::Vector{T}, ry::Union(UnitRange{TI},Range{TI})) length(rx)==length(ry) || throw(DimensionMismatch("")) if minimum(rx) < 1 || maximum(rx) > length(x) || minimum(ry) < 1 || maximum(ry) > length(y) @@ -58,9 +58,9 @@ function dot(x::AbstractVector, y::AbstractVector) s end dot(x::Number, y::Number) = conj(x) * y -Ac_mul_B(x::Vector, y::Vector) = [dot(x, y)] -At_mul_B{T<:Real}(x::Vector{T}, y::Vector{T}) = [dot(x, y)] -At_mul_B{T<:BlasComplex}(x::Vector{T}, y::Vector{T}) = [BLAS.dotu(x, y)] +Ac_mul_B(x::AbstractVector, y::AbstractVector) = [dot(x, y)] +At_mul_B{T<:Real}(x::AbstractVector{T}, y::AbstractVector{T}) = [dot(x, y)] +At_mul_B{T<:BlasComplex}(x::StridedVector{T}, y::StridedVector{T}) = [BLAS.dotu(x, y)] # Matrix-vector multiplication function (*){T<:BlasFloat,S}(A::StridedMatrix{T}, x::StridedVector{S}) From 1ff6e0afcbf16e327488beae4eb95b2881b2bb54 Mon Sep 17 00:00:00 2001 From: Mike Nolta Date: Mon, 6 Oct 2014 22:13:36 -0400 Subject: [PATCH 02/25] faster binary gcd algorithm for 64 & 128 bit ints --- base/intfuncs.jl | 20 ++++++++++++++++++++ test/numbers.jl | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/base/intfuncs.jl b/base/intfuncs.jl index ac1a0a342e1ecd..182066d866219a 100644 --- a/base/intfuncs.jl +++ b/base/intfuncs.jl @@ -9,6 +9,26 @@ function gcd{T<:Integer}(a::T, b::T) abs(a) end +# binary GCD (aka Stein's) algorithm +# about 1.7x (2.1x) faster for random Int64s (Int128s) +function gcd{T<:Union(Int64,Uint64,Int128,Uint128)}(a::T, b::T) + a == 0 && return abs(b) + b == 0 && return abs(a) + za = trailing_zeros(a) + zb = trailing_zeros(b) + k = min(za, zb) + u = abs(a >> za) + v = abs(b >> zb) + while u != v + if u > v + u, v = v, u + end + v -= u + v >>= trailing_zeros(v) + end + u << k +end + # explicit a==0 test is to handle case of lcm(0,0) correctly lcm{T<:Integer}(a::T, b::T) = a == 0 ? a : abs(a * div(b, gcd(b,a))) diff --git a/test/numbers.jl b/test/numbers.jl index c5ac9bc5e759f1..6ad56990b8f3eb 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -1798,7 +1798,8 @@ end @test 3//2 <= typemax(Int) # check gcd and related functions against GMP -for i = -20:20, j = -20:20 +for T in (Int32,Int64), ii = -20:20, jj = -20:20 + i::T, j::T = ii, jj local d = gcd(i,j) @test d >= 0 @test lcm(i,j) >= 0 From 72f43123f72589eaad23f66817a2158f95bfd2c5 Mon Sep 17 00:00:00 2001 From: jake bolewski Date: Tue, 7 Oct 2014 12:26:32 -0400 Subject: [PATCH 03/25] deprecated syntax in 0.3 now raises an error in 0.4 --- src/julia-parser.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index de71be87a12303..85d789f17c9d38 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -668,8 +668,8 @@ ex) (let ((argument (cond ((closing-token? (peek-token s)) - (syntax-deprecation-warning s "x[i:]" "x[i:end]") - ':) ; missing last argument + (error (string "missing last argument in \"" + (deparse ex) ":\" range expression "))) ((newline? (peek-token s)) (error "line break in \":\" expression")) (else From 9f238c5673e99e4804eac3870503aab2f171d427 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Tue, 7 Oct 2014 23:48:56 +0530 Subject: [PATCH 04/25] Fix #8604 --- base/sparse/sparsematrix.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index e65a4353addf27..4a34483588dc83 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -1799,8 +1799,13 @@ function hcat(X::SparseMatrixCSC...) @inbounds for i = 1 : num XI = X[i] colptr[(1 : nX[i] + 1) + nX_sofar] = XI.colptr .+ nnz_sofar - rowval[(1 : nnzX[i]) + nnz_sofar] = XI.rowval - nzval[(1 : nnzX[i]) + nnz_sofar] = XI.nzval + if nnzX[i] == length(XI.rowval) + rowval[(1 : nnzX[i]) + nnz_sofar] = XI.rowval + nzval[(1 : nnzX[i]) + nnz_sofar] = XI.nzval + else + rowval[(1 : nnzX[i]) + nnz_sofar] = XI.rowval[1:nnzX[i]] + nzval[(1 : nnzX[i]) + nnz_sofar] = XI.nzval[1:nnzX[i]] + end nnz_sofar += nnzX[i] nX_sofar += nX[i] end From 9281c06b64153d05d68351ae789f09ea94d57f99 Mon Sep 17 00:00:00 2001 From: "Viral B. Shah" Date: Wed, 8 Oct 2014 00:08:56 +0530 Subject: [PATCH 05/25] Fix #6965 by using xLAHQR from LAPACK 2. This essentially applies https://github.com/opencollab/arpack-ng/pull/2 which we can use until upstream releases a new version. Also, download arpack-ng from github. Add test, but disabled for now as it will fail on stock arpack used by distros. --- deps/Makefile | 7 +- deps/arpack.xlahqr2.patch | 994 +++++++++++++++++++ deps/checksums/arpack-ng-3.1.5.tar.gz/md5 | 1 + deps/checksums/arpack-ng-3.1.5.tar.gz/sha512 | 1 + deps/checksums/arpack-ng_3.1.5.tar.gz/md5 | 1 - deps/checksums/arpack-ng_3.1.5.tar.gz/sha512 | 1 - test/arpack.jl | 7 + 7 files changed, 1007 insertions(+), 5 deletions(-) create mode 100644 deps/arpack.xlahqr2.patch create mode 100644 deps/checksums/arpack-ng-3.1.5.tar.gz/md5 create mode 100644 deps/checksums/arpack-ng-3.1.5.tar.gz/sha512 delete mode 100644 deps/checksums/arpack-ng_3.1.5.tar.gz/md5 delete mode 100644 deps/checksums/arpack-ng_3.1.5.tar.gz/sha512 diff --git a/deps/Makefile b/deps/Makefile index 02767631378634..7c77942f057e12 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -1050,12 +1050,13 @@ ARPACK_FLAGS += LDFLAGS="$(LDFLAGS) -Wl,-rpath,'$(build_libdir)'" endif # ARPACK-NG upstream keeps changing their download filenames -arpack-ng_$(ARPACK_VER).tar.gz: - $(JLDOWNLOAD) $@ http://forge.scilab.org/index.php/p/arpack-ng/downloads/get/$@ +arpack-ng-$(ARPACK_VER).tar.gz: + $(JLDOWNLOAD) $@ https://github.com/opencollab/arpack-ng/archive/$(ARPACK_VER).tar.gz touch -c $@ -arpack-ng-$(ARPACK_VER)/configure: arpack-ng_$(ARPACK_VER).tar.gz +arpack-ng-$(ARPACK_VER)/configure: arpack-ng-$(ARPACK_VER).tar.gz $(JLCHECKSUM) $< $(TAR) zxf $< + ( cd arpack-ng-$(ARPACK_VER) && patch -p1 < ../arpack.xlahqr2.patch ) touch -c $@ ifeq ($(USE_ATLAS), 1) diff --git a/deps/arpack.xlahqr2.patch b/deps/arpack.xlahqr2.patch new file mode 100644 index 00000000000000..e10de156199127 --- /dev/null +++ b/deps/arpack.xlahqr2.patch @@ -0,0 +1,994 @@ +diff -rupN arpack-ng-3.1.5/SRC/Makefile.am arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/Makefile.am +--- arpack-ng-3.1.5/SRC/Makefile.am 2014-02-14 16:25:43.000000000 +0530 ++++ arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/Makefile.am 2014-09-15 04:10:16.000000000 +0530 +@@ -7,10 +7,10 @@ libarpacksrc_la_SOURCES = \ + dgetv0.f dlaqrb.f dstqrb.f dsortc.f dsortr.f dstatn.f dstats.f \ + dnaitr.f dnapps.f dnaup2.f dnaupd.f dnconv.f dneigh.f dngets.f \ + dsaitr.f dsapps.f dsaup2.f dsaupd.f dsconv.f dseigt.f dsgets.f \ +- dneupd.f dseupd.f dsesrt.f \ ++ dneupd.f dseupd.f dsesrt.f dlahqr2.f slahqr2.f \ + cnaitr.f cnapps.f cnaup2.f cnaupd.f cneigh.f cneupd.f cngets.f \ + cgetv0.f csortc.f cstatn.f \ + znaitr.f znapps.f znaup2.f znaupd.f zneigh.f zneupd.f zngets.f \ + zgetv0.f zsortc.f zstatn.f + +-EXTRA_DIST = debug.h stat.h version.h +\ No newline at end of file ++EXTRA_DIST = debug.h stat.h version.h +diff -rupN arpack-ng-3.1.5/SRC/Makefile.in arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/Makefile.in +--- arpack-ng-3.1.5/SRC/Makefile.in 2014-02-15 19:16:02.000000000 +0530 ++++ arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/Makefile.in 2014-09-15 04:10:16.000000000 +0530 +@@ -101,10 +101,10 @@ am_libarpacksrc_la_OBJECTS = sgetv0.lo s + dsortr.lo dstatn.lo dstats.lo dnaitr.lo dnapps.lo dnaup2.lo \ + dnaupd.lo dnconv.lo dneigh.lo dngets.lo dsaitr.lo dsapps.lo \ + dsaup2.lo dsaupd.lo dsconv.lo dseigt.lo dsgets.lo dneupd.lo \ +- dseupd.lo dsesrt.lo cnaitr.lo cnapps.lo cnaup2.lo cnaupd.lo \ +- cneigh.lo cneupd.lo cngets.lo cgetv0.lo csortc.lo cstatn.lo \ +- znaitr.lo znapps.lo znaup2.lo znaupd.lo zneigh.lo zneupd.lo \ +- zngets.lo zgetv0.lo zsortc.lo zstatn.lo ++ dseupd.lo dsesrt.lo dlahqr2.lo slahqr2.lo cnaitr.lo cnapps.lo \ ++ cnaup2.lo cnaupd.lo cneigh.lo cneupd.lo cngets.lo cgetv0.lo \ ++ csortc.lo cstatn.lo znaitr.lo znapps.lo znaup2.lo znaupd.lo \ ++ zneigh.lo zneupd.lo zngets.lo zgetv0.lo zsortc.lo zstatn.lo + libarpacksrc_la_OBJECTS = $(am_libarpacksrc_la_OBJECTS) + AM_V_lt = $(am__v_lt_@AM_V@) + am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +@@ -298,7 +298,7 @@ libarpacksrc_la_SOURCES = \ + dgetv0.f dlaqrb.f dstqrb.f dsortc.f dsortr.f dstatn.f dstats.f \ + dnaitr.f dnapps.f dnaup2.f dnaupd.f dnconv.f dneigh.f dngets.f \ + dsaitr.f dsapps.f dsaup2.f dsaupd.f dsconv.f dseigt.f dsgets.f \ +- dneupd.f dseupd.f dsesrt.f \ ++ dneupd.f dseupd.f dsesrt.f dlahqr2.f slahqr2.f \ + cnaitr.f cnapps.f cnaup2.f cnaupd.f cneigh.f cneupd.f cngets.f \ + cgetv0.f csortc.f cstatn.f \ + znaitr.f znapps.f znaup2.f znaupd.f zneigh.f zneupd.f zngets.f \ +diff -rupN arpack-ng-3.1.5/SRC/dlahqr2.f arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/dlahqr2.f +--- arpack-ng-3.1.5/SRC/dlahqr2.f 1970-01-01 05:30:00.000000000 +0530 ++++ arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/dlahqr2.f 2014-09-15 04:10:16.000000000 +0530 +@@ -0,0 +1,410 @@ ++ SUBROUTINE DLAHQR2( WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI, ++ $ ILOZ, IHIZ, Z, LDZ, INFO ) ++* ++* -- LAPACK auxiliary routine (version 2.0) -- ++* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., ++* Courant Institute, Argonne National Lab, and Rice University ++* October 31, 1992 ++* ++* .. Scalar Arguments .. ++ LOGICAL WANTT, WANTZ ++ INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH, LDZ, N ++* .. ++* .. Array Arguments .. ++ DOUBLE PRECISION H( LDH, * ), WI( * ), WR( * ), Z( LDZ, * ) ++* .. ++* ++* Purpose ++* ======= ++* ++* DLAHQR2 is an auxiliary routine called by DHSEQR to update the ++* eigenvalues and Schur decomposition already computed by DHSEQR, by ++* dealing with the Hessenberg submatrix in rows and columns ILO to IHI. ++* ++* Arguments ++* ========= ++* ++* WANTT (input) LOGICAL ++* = .TRUE. : the full Schur form T is required; ++* = .FALSE.: only eigenvalues are required. ++* ++* WANTZ (input) LOGICAL ++* = .TRUE. : the matrix of Schur vectors Z is required; ++* = .FALSE.: Schur vectors are not required. ++* ++* N (input) INTEGER ++* The order of the matrix H. N >= 0. ++* ++* ILO (input) INTEGER ++* IHI (input) INTEGER ++* It is assumed that H is already upper quasi-triangular in ++* rows and columns IHI+1:N, and that H(ILO,ILO-1) = 0 (unless ++* ILO = 1). DLAHQR works primarily with the Hessenberg ++* submatrix in rows and columns ILO to IHI, but applies ++* transformations to all of H if WANTT is .TRUE.. ++* 1 <= ILO <= max(1,IHI); IHI <= N. ++* ++* H (input/output) DOUBLE PRECISION array, dimension (LDH,N) ++* On entry, the upper Hessenberg matrix H. ++* On exit, if WANTT is .TRUE., H is upper quasi-triangular in ++* rows and columns ILO:IHI, with any 2-by-2 diagonal blocks in ++* standard form. If WANTT is .FALSE., the contents of H are ++* unspecified on exit. ++* ++* LDH (input) INTEGER ++* The leading dimension of the array H. LDH >= max(1,N). ++* ++* WR (output) DOUBLE PRECISION array, dimension (N) ++* WI (output) DOUBLE PRECISION array, dimension (N) ++* The real and imaginary parts, respectively, of the computed ++* eigenvalues ILO to IHI are stored in the corresponding ++* elements of WR and WI. If two eigenvalues are computed as a ++* complex conjugate pair, they are stored in consecutive ++* elements of WR and WI, say the i-th and (i+1)th, with ++* WI(i) > 0 and WI(i+1) < 0. If WANTT is .TRUE., the ++* eigenvalues are stored in the same order as on the diagonal ++* of the Schur form returned in H, with WR(i) = H(i,i), and, if ++* H(i:i+1,i:i+1) is a 2-by-2 diagonal block, ++* WI(i) = sqrt(H(i+1,i)*H(i,i+1)) and WI(i+1) = -WI(i). ++* ++* ILOZ (input) INTEGER ++* IHIZ (input) INTEGER ++* Specify the rows of Z to which transformations must be ++* applied if WANTZ is .TRUE.. ++* 1 <= ILOZ <= ILO; IHI <= IHIZ <= N. ++* ++* Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N) ++* If WANTZ is .TRUE., on entry Z must contain the current ++* matrix Z of transformations accumulated by DHSEQR, and on ++* exit Z has been updated; transformations are applied only to ++* the submatrix Z(ILOZ:IHIZ,ILO:IHI). ++* If WANTZ is .FALSE., Z is not referenced. ++* ++* LDZ (input) INTEGER ++* The leading dimension of the array Z. LDZ >= max(1,N). ++* ++* INFO (output) INTEGER ++* = 0: successful exit ++* > 0: DLAHQR failed to compute all the eigenvalues ILO to IHI ++* in a total of 30*(IHI-ILO+1) iterations; if INFO = i, ++* elements i+1:ihi of WR and WI contain those eigenvalues ++* which have been successfully computed. ++* ++* ===================================================================== ++* ++* .. Parameters .. ++ DOUBLE PRECISION ZERO, ONE ++ PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) ++ DOUBLE PRECISION DAT1, DAT2 ++ PARAMETER ( DAT1 = 0.75D+0, DAT2 = -0.4375D+0 ) ++* .. ++* .. Local Scalars .. ++ INTEGER I, I1, I2, ITN, ITS, J, K, L, M, NH, NR, NZ ++ DOUBLE PRECISION CS, H00, H10, H11, H12, H21, H22, H33, H33S, ++ $ H43H34, H44, H44S, OVFL, S, SMLNUM, SN, SUM, ++ $ T1, T2, T3, TST1, ULP, UNFL, V1, V2, V3 ++* .. ++* .. Local Arrays .. ++ DOUBLE PRECISION V( 3 ), WORK( 1 ) ++* .. ++* .. External Functions .. ++ DOUBLE PRECISION DLAMCH, DLANHS ++ EXTERNAL DLAMCH, DLANHS ++* .. ++* .. External Subroutines .. ++ EXTERNAL DCOPY, DLABAD, DLANV2, DLARFG, DROT ++* .. ++* .. Intrinsic Functions .. ++ INTRINSIC ABS, MAX, MIN ++* .. ++* .. Executable Statements .. ++* ++ INFO = 0 ++* ++* Quick return if possible ++* ++ IF( N.EQ.0 ) ++ $ RETURN ++ IF( ILO.EQ.IHI ) THEN ++ WR( ILO ) = H( ILO, ILO ) ++ WI( ILO ) = ZERO ++ RETURN ++ END IF ++* ++ NH = IHI - ILO + 1 ++ NZ = IHIZ - ILOZ + 1 ++* ++* Set machine-dependent constants for the stopping criterion. ++* If norm(H) <= sqrt(OVFL), overflow should not occur. ++* ++ UNFL = DLAMCH( 'Safe minimum' ) ++ OVFL = ONE / UNFL ++ CALL DLABAD( UNFL, OVFL ) ++ ULP = DLAMCH( 'Precision' ) ++ SMLNUM = UNFL*( NH / ULP ) ++* ++* I1 and I2 are the indices of the first row and last column of H ++* to which transformations must be applied. If eigenvalues only are ++* being computed, I1 and I2 are set inside the main loop. ++* ++ IF( WANTT ) THEN ++ I1 = 1 ++ I2 = N ++ END IF ++* ++* ITN is the total number of QR iterations allowed. ++* ++ ITN = 30*NH ++* ++* The main loop begins here. I is the loop index and decreases from ++* IHI to ILO in steps of 1 or 2. Each iteration of the loop works ++* with the active submatrix in rows and columns L to I. ++* Eigenvalues I+1 to IHI have already converged. Either L = ILO or ++* H(L,L-1) is negligible so that the matrix splits. ++* ++ I = IHI ++ 10 CONTINUE ++ L = ILO ++ IF( I.LT.ILO ) ++ $ GO TO 150 ++* ++* Perform QR iterations on rows and columns ILO to I until a ++* submatrix of order 1 or 2 splits off at the bottom because a ++* subdiagonal element has become negligible. ++* ++ DO 130 ITS = 0, ITN ++* ++* Look for a single small subdiagonal element. ++* ++ DO 20 K = I, L + 1, -1 ++ TST1 = ABS( H( K-1, K-1 ) ) + ABS( H( K, K ) ) ++ IF( TST1.EQ.ZERO ) ++ $ TST1 = DLANHS( '1', I-L+1, H( L, L ), LDH, WORK ) ++ IF( ABS( H( K, K-1 ) ).LE.MAX( ULP*TST1, SMLNUM ) ) ++ $ GO TO 30 ++ 20 CONTINUE ++ 30 CONTINUE ++ L = K ++ IF( L.GT.ILO ) THEN ++* ++* H(L,L-1) is negligible ++* ++ H( L, L-1 ) = ZERO ++ END IF ++* ++* Exit from loop if a submatrix of order 1 or 2 has split off. ++* ++ IF( L.GE.I-1 ) ++ $ GO TO 140 ++* ++* Now the active submatrix is in rows and columns L to I. If ++* eigenvalues only are being computed, only the active submatrix ++* need be transformed. ++* ++ IF( .NOT.WANTT ) THEN ++ I1 = L ++ I2 = I ++ END IF ++* ++ IF( ITS.EQ.10 .OR. ITS.EQ.20 ) THEN ++* ++* Exceptional shift. ++* ++ S = ABS( H( I, I-1 ) ) + ABS( H( I-1, I-2 ) ) ++ H44 = DAT1*S ++ H33 = H44 ++ H43H34 = DAT2*S*S ++ ELSE ++* ++* Prepare to use Wilkinson's double shift ++* ++ H44 = H( I, I ) ++ H33 = H( I-1, I-1 ) ++ H43H34 = H( I, I-1 )*H( I-1, I ) ++ END IF ++* ++* Look for two consecutive small subdiagonal elements. ++* ++ DO 40 M = I - 2, L, -1 ++* ++* Determine the effect of starting the double-shift QR ++* iteration at row M, and see if this would make H(M,M-1) ++* negligible. ++* ++ H11 = H( M, M ) ++ H22 = H( M+1, M+1 ) ++ H21 = H( M+1, M ) ++ H12 = H( M, M+1 ) ++ H44S = H44 - H11 ++ H33S = H33 - H11 ++ V1 = ( H33S*H44S-H43H34 ) / H21 + H12 ++ V2 = H22 - H11 - H33S - H44S ++ V3 = H( M+2, M+1 ) ++ S = ABS( V1 ) + ABS( V2 ) + ABS( V3 ) ++ V1 = V1 / S ++ V2 = V2 / S ++ V3 = V3 / S ++ V( 1 ) = V1 ++ V( 2 ) = V2 ++ V( 3 ) = V3 ++ IF( M.EQ.L ) ++ $ GO TO 50 ++ H00 = H( M-1, M-1 ) ++ H10 = H( M, M-1 ) ++ TST1 = ABS( V1 )*( ABS( H00 )+ABS( H11 )+ABS( H22 ) ) ++ IF( ABS( H10 )*( ABS( V2 )+ABS( V3 ) ).LE.ULP*TST1 ) ++ $ GO TO 50 ++ 40 CONTINUE ++ 50 CONTINUE ++* ++* Double-shift QR step ++* ++ DO 120 K = M, I - 1 ++* ++* The first iteration of this loop determines a reflection G ++* from the vector V and applies it from left and right to H, ++* thus creating a nonzero bulge below the subdiagonal. ++* ++* Each subsequent iteration determines a reflection G to ++* restore the Hessenberg form in the (K-1)th column, and thus ++* chases the bulge one step toward the bottom of the active ++* submatrix. NR is the order of G. ++* ++ NR = MIN( 3, I-K+1 ) ++ IF( K.GT.M ) ++ $ CALL DCOPY( NR, H( K, K-1 ), 1, V, 1 ) ++ CALL DLARFG( NR, V( 1 ), V( 2 ), 1, T1 ) ++ IF( K.GT.M ) THEN ++ H( K, K-1 ) = V( 1 ) ++ H( K+1, K-1 ) = ZERO ++ IF( K.LT.I-1 ) ++ $ H( K+2, K-1 ) = ZERO ++ ELSE IF( M.GT.L ) THEN ++ H( K, K-1 ) = -H( K, K-1 ) ++ END IF ++ V2 = V( 2 ) ++ T2 = T1*V2 ++ IF( NR.EQ.3 ) THEN ++ V3 = V( 3 ) ++ T3 = T1*V3 ++* ++* Apply G from the left to transform the rows of the matrix ++* in columns K to I2. ++* ++ DO 60 J = K, I2 ++ SUM = H( K, J ) + V2*H( K+1, J ) + V3*H( K+2, J ) ++ H( K, J ) = H( K, J ) - SUM*T1 ++ H( K+1, J ) = H( K+1, J ) - SUM*T2 ++ H( K+2, J ) = H( K+2, J ) - SUM*T3 ++ 60 CONTINUE ++* ++* Apply G from the right to transform the columns of the ++* matrix in rows I1 to min(K+3,I). ++* ++ DO 70 J = I1, MIN( K+3, I ) ++ SUM = H( J, K ) + V2*H( J, K+1 ) + V3*H( J, K+2 ) ++ H( J, K ) = H( J, K ) - SUM*T1 ++ H( J, K+1 ) = H( J, K+1 ) - SUM*T2 ++ H( J, K+2 ) = H( J, K+2 ) - SUM*T3 ++ 70 CONTINUE ++* ++ IF( WANTZ ) THEN ++* ++* Accumulate transformations in the matrix Z ++* ++ DO 80 J = ILOZ, IHIZ ++ SUM = Z( J, K ) + V2*Z( J, K+1 ) + V3*Z( J, K+2 ) ++ Z( J, K ) = Z( J, K ) - SUM*T1 ++ Z( J, K+1 ) = Z( J, K+1 ) - SUM*T2 ++ Z( J, K+2 ) = Z( J, K+2 ) - SUM*T3 ++ 80 CONTINUE ++ END IF ++ ELSE IF( NR.EQ.2 ) THEN ++* ++* Apply G from the left to transform the rows of the matrix ++* in columns K to I2. ++* ++ DO 90 J = K, I2 ++ SUM = H( K, J ) + V2*H( K+1, J ) ++ H( K, J ) = H( K, J ) - SUM*T1 ++ H( K+1, J ) = H( K+1, J ) - SUM*T2 ++ 90 CONTINUE ++* ++* Apply G from the right to transform the columns of the ++* matrix in rows I1 to min(K+3,I). ++* ++ DO 100 J = I1, I ++ SUM = H( J, K ) + V2*H( J, K+1 ) ++ H( J, K ) = H( J, K ) - SUM*T1 ++ H( J, K+1 ) = H( J, K+1 ) - SUM*T2 ++ 100 CONTINUE ++* ++ IF( WANTZ ) THEN ++* ++* Accumulate transformations in the matrix Z ++* ++ DO 110 J = ILOZ, IHIZ ++ SUM = Z( J, K ) + V2*Z( J, K+1 ) ++ Z( J, K ) = Z( J, K ) - SUM*T1 ++ Z( J, K+1 ) = Z( J, K+1 ) - SUM*T2 ++ 110 CONTINUE ++ END IF ++ END IF ++ 120 CONTINUE ++* ++ 130 CONTINUE ++* ++* Failure to converge in remaining number of iterations ++* ++ INFO = I ++ RETURN ++* ++ 140 CONTINUE ++* ++ IF( L.EQ.I ) THEN ++* ++* H(I,I-1) is negligible: one eigenvalue has converged. ++* ++ WR( I ) = H( I, I ) ++ WI( I ) = ZERO ++ ELSE IF( L.EQ.I-1 ) THEN ++* ++* H(I-1,I-2) is negligible: a pair of eigenvalues have converged. ++* ++* Transform the 2-by-2 submatrix to standard Schur form, ++* and compute and store the eigenvalues. ++* ++ CALL DLANV2( H( I-1, I-1 ), H( I-1, I ), H( I, I-1 ), ++ $ H( I, I ), WR( I-1 ), WI( I-1 ), WR( I ), WI( I ), ++ $ CS, SN ) ++* ++ IF( WANTT ) THEN ++* ++* Apply the transformation to the rest of H. ++* ++ IF( I2.GT.I ) ++ $ CALL DROT( I2-I, H( I-1, I+1 ), LDH, H( I, I+1 ), LDH, ++ $ CS, SN ) ++ CALL DROT( I-I1-1, H( I1, I-1 ), 1, H( I1, I ), 1, CS, SN ) ++ END IF ++ IF( WANTZ ) THEN ++* ++* Apply the transformation to Z. ++* ++ CALL DROT( NZ, Z( ILOZ, I-1 ), 1, Z( ILOZ, I ), 1, CS, SN ) ++ END IF ++ END IF ++* ++* Decrement number of remaining iterations, and return to start of ++* the main loop with new value of I. ++* ++ ITN = ITN - ITS ++ I = L - 1 ++ GO TO 10 ++* ++ 150 CONTINUE ++ RETURN ++* ++* End of DLAHQR ++* ++ END +diff -rupN arpack-ng-3.1.5/SRC/dneupd.f arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/dneupd.f +--- arpack-ng-3.1.5/SRC/dneupd.f 2014-02-14 16:25:43.000000000 +0530 ++++ arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/dneupd.f 2014-09-15 04:10:16.000000000 +0530 +@@ -181,7 +181,7 @@ c Error flag on output. + c + c = 0: Normal exit. + c +-c = 1: The Schur form computed by LAPACK routine dlahqr ++c = 1: The Schur form computed by LAPACK routine dlahqr2 + c could not be reordered by LAPACK routine dtrsen . + c Re-enter subroutine dneupd with IPARAM(5)=NCV and + c increase the size of the arrays DR and DI to have +@@ -197,7 +197,7 @@ c = -5: WHICH must be one of 'L + c = -6: BMAT must be one of 'I' or 'G'. + c = -7: Length of private work WORKL array is not sufficient. + c = -8: Error return from calculation of a real Schur form. +-c Informational error from LAPACK routine dlahqr . ++c Informational error from LAPACK routine dlahqr2 . + c = -9: Error return from calculation of eigenvectors. + c Informational error from LAPACK routine dtrevc . + c = -10: IPARAM(7) must be 1,2,3,4. +@@ -232,7 +232,7 @@ c dvout ARPACK utility routine th + c dgeqr2 LAPACK routine that computes the QR factorization of + c a matrix. + c dlacpy LAPACK matrix copy routine. +-c dlahqr LAPACK routine to compute the real Schur form of an ++c dlahqr2 LAPACK routine to compute the real Schur form of an + c upper Hessenberg matrix. + c dlamch LAPACK routine that determines machine constants. + c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully. +@@ -364,7 +364,7 @@ c | External Subroutines | + c %----------------------% + c + external dcopy , dger , dgeqr2 , dlacpy , +- & dlahqr , dlaset , dmout , dorm2r , ++ & dlahqr2 , dlaset , dmout , dorm2r , + & dtrevc , dtrmm , dtrsen , dscal , + & dvout , ivout + c +@@ -612,18 +612,18 @@ c + go to 9000 + end if + c +-c %-----------------------------------------------------------% +-c | Call LAPACK routine dlahqr to compute the real Schur form | +-c | of the upper Hessenberg matrix returned by DNAUPD . | +-c | Make a copy of the upper Hessenberg matrix. | +-c | Initialize the Schur vector matrix Q to the identity. | +-c %-----------------------------------------------------------% ++c %-------------------------------------------------------------% ++c | Call LAPACK routine dlahqr2 to compute the real Schur form | ++c | of the upper Hessenberg matrix returned by DNAUPD . | ++c | Make a copy of the upper Hessenberg matrix. | ++c | Initialize the Schur vector matrix Q to the identity. | ++c %-------------------------------------------------------------% + c + call dcopy (ldh*ncv, workl(ih), 1, workl(iuptri), 1) + call dlaset ('All', ncv, ncv, + & zero , one, workl(invsub), + & ldq) +- call dlahqr (.true., .true. , ncv, ++ call dlahqr2 (.true., .true. , ncv, + & 1 , ncv , workl(iuptri), + & ldh , workl(iheigr), workl(iheigi), + & 1 , ncv , workl(invsub), +diff -rupN arpack-ng-3.1.5/SRC/slahqr2.f arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/slahqr2.f +--- arpack-ng-3.1.5/SRC/slahqr2.f 1970-01-01 05:30:00.000000000 +0530 ++++ arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/slahqr2.f 2014-09-15 04:10:16.000000000 +0530 +@@ -0,0 +1,410 @@ ++ SUBROUTINE SLAHQR2( WANTT, WANTZ, N, ILO, IHI, H, LDH, WR, WI, ++ $ ILOZ, IHIZ, Z, LDZ, INFO ) ++* ++* -- LAPACK auxiliary routine (version 2.0) -- ++* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., ++* Courant Institute, Argonne National Lab, and Rice University ++* October 31, 1992 ++* ++* .. Scalar Arguments .. ++ LOGICAL WANTT, WANTZ ++ INTEGER IHI, IHIZ, ILO, ILOZ, INFO, LDH, LDZ, N ++* .. ++* .. Array Arguments .. ++ REAL H( LDH, * ), WI( * ), WR( * ), Z( LDZ, * ) ++* .. ++* ++* Purpose ++* ======= ++* ++* SLAHQR2 is an auxiliary routine called by SHSEQR to update the ++* eigenvalues and Schur decomposition already computed by SHSEQR, by ++* dealing with the Hessenberg submatrix in rows and columns ILO to IHI. ++* ++* Arguments ++* ========= ++* ++* WANTT (input) LOGICAL ++* = .TRUE. : the full Schur form T is required; ++* = .FALSE.: only eigenvalues are required. ++* ++* WANTZ (input) LOGICAL ++* = .TRUE. : the matrix of Schur vectors Z is required; ++* = .FALSE.: Schur vectors are not required. ++* ++* N (input) INTEGER ++* The order of the matrix H. N >= 0. ++* ++* ILO (input) INTEGER ++* IHI (input) INTEGER ++* It is assumed that H is already upper quasi-triangular in ++* rows and columns IHI+1:N, and that H(ILO,ILO-1) = 0 (unless ++* ILO = 1). SLAHQR works primarily with the Hessenberg ++* submatrix in rows and columns ILO to IHI, but applies ++* transformations to all of H if WANTT is .TRUE.. ++* 1 <= ILO <= max(1,IHI); IHI <= N. ++* ++* H (input/output) REAL array, dimension (LDH,N) ++* On entry, the upper Hessenberg matrix H. ++* On exit, if WANTT is .TRUE., H is upper quasi-triangular in ++* rows and columns ILO:IHI, with any 2-by-2 diagonal blocks in ++* standard form. If WANTT is .FALSE., the contents of H are ++* unspecified on exit. ++* ++* LDH (input) INTEGER ++* The leading dimension of the array H. LDH >= max(1,N). ++* ++* WR (output) REAL array, dimension (N) ++* WI (output) REAL array, dimension (N) ++* The real and imaginary parts, respectively, of the computed ++* eigenvalues ILO to IHI are stored in the corresponding ++* elements of WR and WI. If two eigenvalues are computed as a ++* complex conjugate pair, they are stored in consecutive ++* elements of WR and WI, say the i-th and (i+1)th, with ++* WI(i) > 0 and WI(i+1) < 0. If WANTT is .TRUE., the ++* eigenvalues are stored in the same order as on the diagonal ++* of the Schur form returned in H, with WR(i) = H(i,i), and, if ++* H(i:i+1,i:i+1) is a 2-by-2 diagonal block, ++* WI(i) = sqrt(H(i+1,i)*H(i,i+1)) and WI(i+1) = -WI(i). ++* ++* ILOZ (input) INTEGER ++* IHIZ (input) INTEGER ++* Specify the rows of Z to which transformations must be ++* applied if WANTZ is .TRUE.. ++* 1 <= ILOZ <= ILO; IHI <= IHIZ <= N. ++* ++* Z (input/output) REAL array, dimension (LDZ,N) ++* If WANTZ is .TRUE., on entry Z must contain the current ++* matrix Z of transformations accumulated by SHSEQR, and on ++* exit Z has been updated; transformations are applied only to ++* the submatrix Z(ILOZ:IHIZ,ILO:IHI). ++* If WANTZ is .FALSE., Z is not referenced. ++* ++* LDZ (input) INTEGER ++* The leading dimension of the array Z. LDZ >= max(1,N). ++* ++* INFO (output) INTEGER ++* = 0: successful exit ++* > 0: SLAHQR failed to compute all the eigenvalues ILO to IHI ++* in a total of 30*(IHI-ILO+1) iterations; if INFO = i, ++* elements i+1:ihi of WR and WI contain those eigenvalues ++* which have been successfully computed. ++* ++* ===================================================================== ++* ++* .. Parameters .. ++ REAL ZERO, ONE ++ PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 ) ++ REAL DAT1, DAT2 ++ PARAMETER ( DAT1 = 0.75E+0, DAT2 = -0.4375E+0 ) ++* .. ++* .. Local Scalars .. ++ INTEGER I, I1, I2, ITN, ITS, J, K, L, M, NH, NR, NZ ++ REAL CS, H00, H10, H11, H12, H21, H22, H33, H33S, ++ $ H43H34, H44, H44S, OVFL, S, SMLNUM, SN, SUM, ++ $ T1, T2, T3, TST1, ULP, UNFL, V1, V2, V3 ++* .. ++* .. Local Arrays .. ++ REAL V( 3 ), WORK( 1 ) ++* .. ++* .. External Functions .. ++ REAL SLAMCH, SLANHS ++ EXTERNAL SLAMCH, SLANHS ++* .. ++* .. External Subroutines .. ++ EXTERNAL SCOPY, SLABAD, SLANV2, SLARFG, SROT ++* .. ++* .. Intrinsic Functions .. ++ INTRINSIC ABS, MAX, MIN ++* .. ++* .. Executable Statements .. ++* ++ INFO = 0 ++* ++* Quick return if possible ++* ++ IF( N.EQ.0 ) ++ $ RETURN ++ IF( ILO.EQ.IHI ) THEN ++ WR( ILO ) = H( ILO, ILO ) ++ WI( ILO ) = ZERO ++ RETURN ++ END IF ++* ++ NH = IHI - ILO + 1 ++ NZ = IHIZ - ILOZ + 1 ++* ++* Set machine-dependent constants for the stopping criterion. ++* If norm(H) <= sqrt(OVFL), overflow should not occur. ++* ++ UNFL = SLAMCH( 'Safe minimum' ) ++ OVFL = ONE / UNFL ++ CALL SLABAD( UNFL, OVFL ) ++ ULP = SLAMCH( 'Precision' ) ++ SMLNUM = UNFL*( NH / ULP ) ++* ++* I1 and I2 are the indices of the first row and last column of H ++* to which transformations must be applied. If eigenvalues only are ++* being computed, I1 and I2 are set inside the main loop. ++* ++ IF( WANTT ) THEN ++ I1 = 1 ++ I2 = N ++ END IF ++* ++* ITN is the total number of QR iterations allowed. ++* ++ ITN = 30*NH ++* ++* The main loop begins here. I is the loop index and decreases from ++* IHI to ILO in steps of 1 or 2. Each iteration of the loop works ++* with the active submatrix in rows and columns L to I. ++* Eigenvalues I+1 to IHI have already converged. Either L = ILO or ++* H(L,L-1) is negligible so that the matrix splits. ++* ++ I = IHI ++ 10 CONTINUE ++ L = ILO ++ IF( I.LT.ILO ) ++ $ GO TO 150 ++* ++* Perform QR iterations on rows and columns ILO to I until a ++* submatrix of order 1 or 2 splits off at the bottom because a ++* subdiagonal element has become negligible. ++* ++ DO 130 ITS = 0, ITN ++* ++* Look for a single small subdiagonal element. ++* ++ DO 20 K = I, L + 1, -1 ++ TST1 = ABS( H( K-1, K-1 ) ) + ABS( H( K, K ) ) ++ IF( TST1.EQ.ZERO ) ++ $ TST1 = SLANHS( '1', I-L+1, H( L, L ), LDH, WORK ) ++ IF( ABS( H( K, K-1 ) ).LE.MAX( ULP*TST1, SMLNUM ) ) ++ $ GO TO 30 ++ 20 CONTINUE ++ 30 CONTINUE ++ L = K ++ IF( L.GT.ILO ) THEN ++* ++* H(L,L-1) is negligible ++* ++ H( L, L-1 ) = ZERO ++ END IF ++* ++* Exit from loop if a submatrix of order 1 or 2 has split off. ++* ++ IF( L.GE.I-1 ) ++ $ GO TO 140 ++* ++* Now the active submatrix is in rows and columns L to I. If ++* eigenvalues only are being computed, only the active submatrix ++* need be transformed. ++* ++ IF( .NOT.WANTT ) THEN ++ I1 = L ++ I2 = I ++ END IF ++* ++ IF( ITS.EQ.10 .OR. ITS.EQ.20 ) THEN ++* ++* Exceptional shift. ++* ++ S = ABS( H( I, I-1 ) ) + ABS( H( I-1, I-2 ) ) ++ H44 = DAT1*S ++ H33 = H44 ++ H43H34 = DAT2*S*S ++ ELSE ++* ++* Prepare to use Wilkinson's double shift ++* ++ H44 = H( I, I ) ++ H33 = H( I-1, I-1 ) ++ H43H34 = H( I, I-1 )*H( I-1, I ) ++ END IF ++* ++* Look for two consecutive small subdiagonal elements. ++* ++ DO 40 M = I - 2, L, -1 ++* ++* Determine the effect of starting the double-shift QR ++* iteration at row M, and see if this would make H(M,M-1) ++* negligible. ++* ++ H11 = H( M, M ) ++ H22 = H( M+1, M+1 ) ++ H21 = H( M+1, M ) ++ H12 = H( M, M+1 ) ++ H44S = H44 - H11 ++ H33S = H33 - H11 ++ V1 = ( H33S*H44S-H43H34 ) / H21 + H12 ++ V2 = H22 - H11 - H33S - H44S ++ V3 = H( M+2, M+1 ) ++ S = ABS( V1 ) + ABS( V2 ) + ABS( V3 ) ++ V1 = V1 / S ++ V2 = V2 / S ++ V3 = V3 / S ++ V( 1 ) = V1 ++ V( 2 ) = V2 ++ V( 3 ) = V3 ++ IF( M.EQ.L ) ++ $ GO TO 50 ++ H00 = H( M-1, M-1 ) ++ H10 = H( M, M-1 ) ++ TST1 = ABS( V1 )*( ABS( H00 )+ABS( H11 )+ABS( H22 ) ) ++ IF( ABS( H10 )*( ABS( V2 )+ABS( V3 ) ).LE.ULP*TST1 ) ++ $ GO TO 50 ++ 40 CONTINUE ++ 50 CONTINUE ++* ++* Double-shift QR step ++* ++ DO 120 K = M, I - 1 ++* ++* The first iteration of this loop determines a reflection G ++* from the vector V and applies it from left and right to H, ++* thus creating a nonzero bulge below the subdiagonal. ++* ++* Each subsequent iteration determines a reflection G to ++* restore the Hessenberg form in the (K-1)th column, and thus ++* chases the bulge one step toward the bottom of the active ++* submatrix. NR is the order of G. ++* ++ NR = MIN( 3, I-K+1 ) ++ IF( K.GT.M ) ++ $ CALL SCOPY( NR, H( K, K-1 ), 1, V, 1 ) ++ CALL SLARFG( NR, V( 1 ), V( 2 ), 1, T1 ) ++ IF( K.GT.M ) THEN ++ H( K, K-1 ) = V( 1 ) ++ H( K+1, K-1 ) = ZERO ++ IF( K.LT.I-1 ) ++ $ H( K+2, K-1 ) = ZERO ++ ELSE IF( M.GT.L ) THEN ++ H( K, K-1 ) = -H( K, K-1 ) ++ END IF ++ V2 = V( 2 ) ++ T2 = T1*V2 ++ IF( NR.EQ.3 ) THEN ++ V3 = V( 3 ) ++ T3 = T1*V3 ++* ++* Apply G from the left to transform the rows of the matrix ++* in columns K to I2. ++* ++ DO 60 J = K, I2 ++ SUM = H( K, J ) + V2*H( K+1, J ) + V3*H( K+2, J ) ++ H( K, J ) = H( K, J ) - SUM*T1 ++ H( K+1, J ) = H( K+1, J ) - SUM*T2 ++ H( K+2, J ) = H( K+2, J ) - SUM*T3 ++ 60 CONTINUE ++* ++* Apply G from the right to transform the columns of the ++* matrix in rows I1 to min(K+3,I). ++* ++ DO 70 J = I1, MIN( K+3, I ) ++ SUM = H( J, K ) + V2*H( J, K+1 ) + V3*H( J, K+2 ) ++ H( J, K ) = H( J, K ) - SUM*T1 ++ H( J, K+1 ) = H( J, K+1 ) - SUM*T2 ++ H( J, K+2 ) = H( J, K+2 ) - SUM*T3 ++ 70 CONTINUE ++* ++ IF( WANTZ ) THEN ++* ++* Accumulate transformations in the matrix Z ++* ++ DO 80 J = ILOZ, IHIZ ++ SUM = Z( J, K ) + V2*Z( J, K+1 ) + V3*Z( J, K+2 ) ++ Z( J, K ) = Z( J, K ) - SUM*T1 ++ Z( J, K+1 ) = Z( J, K+1 ) - SUM*T2 ++ Z( J, K+2 ) = Z( J, K+2 ) - SUM*T3 ++ 80 CONTINUE ++ END IF ++ ELSE IF( NR.EQ.2 ) THEN ++* ++* Apply G from the left to transform the rows of the matrix ++* in columns K to I2. ++* ++ DO 90 J = K, I2 ++ SUM = H( K, J ) + V2*H( K+1, J ) ++ H( K, J ) = H( K, J ) - SUM*T1 ++ H( K+1, J ) = H( K+1, J ) - SUM*T2 ++ 90 CONTINUE ++* ++* Apply G from the right to transform the columns of the ++* matrix in rows I1 to min(K+3,I). ++* ++ DO 100 J = I1, I ++ SUM = H( J, K ) + V2*H( J, K+1 ) ++ H( J, K ) = H( J, K ) - SUM*T1 ++ H( J, K+1 ) = H( J, K+1 ) - SUM*T2 ++ 100 CONTINUE ++* ++ IF( WANTZ ) THEN ++* ++* Accumulate transformations in the matrix Z ++* ++ DO 110 J = ILOZ, IHIZ ++ SUM = Z( J, K ) + V2*Z( J, K+1 ) ++ Z( J, K ) = Z( J, K ) - SUM*T1 ++ Z( J, K+1 ) = Z( J, K+1 ) - SUM*T2 ++ 110 CONTINUE ++ END IF ++ END IF ++ 120 CONTINUE ++* ++ 130 CONTINUE ++* ++* Failure to converge in remaining number of iterations ++* ++ INFO = I ++ RETURN ++* ++ 140 CONTINUE ++* ++ IF( L.EQ.I ) THEN ++* ++* H(I,I-1) is negligible: one eigenvalue has converged. ++* ++ WR( I ) = H( I, I ) ++ WI( I ) = ZERO ++ ELSE IF( L.EQ.I-1 ) THEN ++* ++* H(I-1,I-2) is negligible: a pair of eigenvalues have converged. ++* ++* Transform the 2-by-2 submatrix to standard Schur form, ++* and compute and store the eigenvalues. ++* ++ CALL SLANV2( H( I-1, I-1 ), H( I-1, I ), H( I, I-1 ), ++ $ H( I, I ), WR( I-1 ), WI( I-1 ), WR( I ), WI( I ), ++ $ CS, SN ) ++* ++ IF( WANTT ) THEN ++* ++* Apply the transformation to the rest of H. ++* ++ IF( I2.GT.I ) ++ $ CALL SROT( I2-I, H( I-1, I+1 ), LDH, H( I, I+1 ), LDH, ++ $ CS, SN ) ++ CALL SROT( I-I1-1, H( I1, I-1 ), 1, H( I1, I ), 1, CS, SN ) ++ END IF ++ IF( WANTZ ) THEN ++* ++* Apply the transformation to Z. ++* ++ CALL SROT( NZ, Z( ILOZ, I-1 ), 1, Z( ILOZ, I ), 1, CS, SN ) ++ END IF ++ END IF ++* ++* Decrement number of remaining iterations, and return to start of ++* the main loop with new value of I. ++* ++ ITN = ITN - ITS ++ I = L - 1 ++ GO TO 10 ++* ++ 150 CONTINUE ++ RETURN ++* ++* End of SLAHQR ++* ++ END +diff -rupN arpack-ng-3.1.5/SRC/sneupd.f arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/sneupd.f +--- arpack-ng-3.1.5/SRC/sneupd.f 2014-02-14 16:25:43.000000000 +0530 ++++ arpack-ng-cbb0bf599d53ea0ef5a5056f833dd04b2fae6b63/SRC/sneupd.f 2014-09-15 04:10:16.000000000 +0530 +@@ -181,7 +181,7 @@ c Error flag on output. + c + c = 0: Normal exit. + c +-c = 1: The Schur form computed by LAPACK routine slahqr ++c = 1: The Schur form computed by LAPACK routine slahqr2 + c could not be reordered by LAPACK routine strsen. + c Re-enter subroutine sneupd with IPARAM(5)=NCV and + c increase the size of the arrays DR and DI to have +@@ -197,7 +197,7 @@ c = -5: WHICH must be one of 'L + c = -6: BMAT must be one of 'I' or 'G'. + c = -7: Length of private work WORKL array is not sufficient. + c = -8: Error return from calculation of a real Schur form. +-c Informational error from LAPACK routine slahqr. ++c Informational error from LAPACK routine slahqr2. + c = -9: Error return from calculation of eigenvectors. + c Informational error from LAPACK routine strevc. + c = -10: IPARAM(7) must be 1,2,3,4. +@@ -232,7 +232,7 @@ c svout ARPACK utility routine tha + c sgeqr2 LAPACK routine that computes the QR factorization of + c a matrix. + c slacpy LAPACK matrix copy routine. +-c slahqr LAPACK routine to compute the real Schur form of an ++c slahqr2 LAPACK routine to compute the real Schur form of an + c upper Hessenberg matrix. + c slamch LAPACK routine that determines machine constants. + c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully. +@@ -364,7 +364,7 @@ c | External Subroutines | + c %----------------------% + c + external scopy , sger , sgeqr2, slacpy, +- & slahqr, slaset, smout , sorm2r, ++ & slahqr2, slaset, smout , sorm2r, + & strevc, strmm , strsen, sscal , + & svout , ivout + c +@@ -613,7 +613,7 @@ c + end if + c + c %-----------------------------------------------------------% +-c | Call LAPACK routine slahqr to compute the real Schur form | ++c | Call LAPACK routine slahqr2 to compute the real Schur form | + c | of the upper Hessenberg matrix returned by SNAUPD. | + c | Make a copy of the upper Hessenberg matrix. | + c | Initialize the Schur vector matrix Q to the identity. | +@@ -623,7 +623,7 @@ c + call slaset('All', ncv, ncv, + & zero , one, workl(invsub), + & ldq) +- call slahqr(.true., .true. , ncv, ++ call slahqr2(.true., .true. , ncv, + & 1 , ncv , workl(iuptri), + & ldh , workl(iheigr), workl(iheigi), + & 1 , ncv , workl(invsub), diff --git a/deps/checksums/arpack-ng-3.1.5.tar.gz/md5 b/deps/checksums/arpack-ng-3.1.5.tar.gz/md5 new file mode 100644 index 00000000000000..196808972325ab --- /dev/null +++ b/deps/checksums/arpack-ng-3.1.5.tar.gz/md5 @@ -0,0 +1 @@ +d84e1b6108d9ee67c0d21aba7099e953 diff --git a/deps/checksums/arpack-ng-3.1.5.tar.gz/sha512 b/deps/checksums/arpack-ng-3.1.5.tar.gz/sha512 new file mode 100644 index 00000000000000..f239a34551fed6 --- /dev/null +++ b/deps/checksums/arpack-ng-3.1.5.tar.gz/sha512 @@ -0,0 +1 @@ +e56cc5dc5947340c50c7bb9916774aea50c5190be7cf266d6b420eb62c27503a15ccf06208160e0f17a7108e849853ea0d6797d1815a45cc1c28ebfd7e79771f diff --git a/deps/checksums/arpack-ng_3.1.5.tar.gz/md5 b/deps/checksums/arpack-ng_3.1.5.tar.gz/md5 deleted file mode 100644 index 5b053804b92a45..00000000000000 --- a/deps/checksums/arpack-ng_3.1.5.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -f773f34079a9c24807da6bc2e72fe6df diff --git a/deps/checksums/arpack-ng_3.1.5.tar.gz/sha512 b/deps/checksums/arpack-ng_3.1.5.tar.gz/sha512 deleted file mode 100644 index e7db2b5d6382b1..00000000000000 --- a/deps/checksums/arpack-ng_3.1.5.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -4876b0babb89bbcc39e92b63d4537b860e9cd0b8a188937d3ba815041b7261623cdac25c91c8bef20ebce4271f822307c492cf6c9f22ec3d740218405337a515 diff --git a/test/arpack.jl b/test/arpack.jl index e8b8ede4716e53..274b4b130e90e8 100644 --- a/test/arpack.jl +++ b/test/arpack.jl @@ -74,6 +74,13 @@ d, = eigs(A6965,which=:SM,nev=2,ncv=4,tol=eps()) @test_approx_eq real(d[2]) 2.6159972444834976 @test_approx_eq abs(imag(d[2])) 1.2917858749046127 +# Requires ARPACK 3.2 or a patched 3.1.5 +#T6965 = [ 0.9 0.05 0.05 +# 0.8 0.1 0.1 +# 0.7 0.1 0.2 ] +#d,v,nconv = eigs(T6965,nev=1,which=:LM) +#@test_approx_eq_eps T6965*v d[1]*v 1e-6 + # Example from Quantum Information Theory import Base: size, issym, ishermitian From 1785871b3c6a9b48f07a78c0f1a50191fc27be8a Mon Sep 17 00:00:00 2001 From: Mike Nolta Date: Sun, 5 Oct 2014 22:52:44 -0400 Subject: [PATCH 06/25] doc: use virtualenv to install juliadoc --- .gitmodules | 4 --- doc/Makefile | 69 +++++++++++++++++++++++----------------------------- doc/conf.py | 7 ------ doc/juliadoc | 1 - 4 files changed, 30 insertions(+), 51 deletions(-) delete mode 160000 doc/juliadoc diff --git a/.gitmodules b/.gitmodules index fae922d6fee39b..33add7255446bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,10 +10,6 @@ [submodule "deps/Rmath"] path = deps/Rmath url = git://github.com/JuliaLang/Rmath.git -[submodule "doc/juliadoc"] - path = doc/juliadoc - url = git://github.com/JuliaLang/JuliaDoc.git - [submodule "deps/libmojibake"] path = deps/libmojibake url = git://github.com/JuliaLang/libmojibake.git diff --git a/doc/Makefile b/doc/Makefile index c2230656e4101d..fb43775ea6df96 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -14,24 +14,20 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -JULIA_ENV=$(JULIAHOME)/deps/julia-env -$(JULIA_ENV)/bin/activate: - $(MAKE) -C $(JULIAHOME)/deps install-virtualenv - touch -c $@ +JULIA_ENV = $(JULIAHOME)/deps/julia-env +ACTIVATE = $(JULIA_ENV)/bin/activate +SPHINX_BUILD = $(JULIA_ENV)/bin/sphinx-build -SPHINX_BUILD=$(JULIA_ENV)/bin/sphinx-build -$(SPHINX_BUILD): $(JULIA_ENV)/bin/activate - . $(JULIA_ENV)/bin/activate && \ - pip install sphinx==1.1.3 +$(ACTIVATE): + $(MAKE) -C $(JULIAHOME)/deps install-virtualenv touch -c $@ -SPHINX_RTD_THEME=$(JULIA_ENV)/lib/python2.7/site-packages/sphinx_rtd_theme -$(SPHINX_RTD_THEME): $(SPHINX_BUILD) - . $(JULIA_ENV)/bin/activate && \ - pip install sphinx_rtd_theme +$(SPHINX_BUILD): $(ACTIVATE) requirements.txt + . $(ACTIVATE) && pip install sphinx==1.1.3 \ + && pip install -r requirements.txt touch -c $@ -SPHINXBUILD = . $(JULIA_ENV)/bin/activate && env PYTHONPATH=juliadoc sphinx-build +SPHINXBUILD = . $(ACTIVATE) && sphinx-build .PHONY: help clean cleanall html dirhtml singlehtml pickle json htmlhelp qthelp devhelp \ epub latex latexpdf text man changes linkcheck doctest gettext @@ -61,46 +57,41 @@ help: clean: -rm -rf $(BUILDDIR)/* - # We also need to remove .pyc files - -find . -name *.pyc -delete cleanall: clean -juliadoc-pkg: juliadoc/juliadoc/__init__.py - @-cd .. && git submodule update doc/juliadoc - -html: juliadoc-pkg $(SPHINX_RTD_THEME) +html: $(SPHINX_BUILD) $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." -dirhtml: juliadoc-pkg $(SPHINX_RTD_THEME) +dirhtml: $(SPHINX_BUILD) $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." -singlehtml: juliadoc-pkg $(SPHINX_RTD_THEME) +singlehtml: $(SPHINX_BUILD) $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." -pickle: juliadoc-pkg $(SPHINX_RTD_THEME) +pickle: $(SPHINX_BUILD) $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." -json: juliadoc-pkg $(SPHINX_RTD_THEME) +json: $(SPHINX_BUILD) $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." -htmlhelp: juliadoc-pkg $(SPHINX_RTD_THEME) +htmlhelp: $(SPHINX_BUILD) $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." -qthelp: juliadoc-pkg $(SPHINX_RTD_THEME) +qthelp: $(SPHINX_BUILD) $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ @@ -109,7 +100,7 @@ qthelp: juliadoc-pkg $(SPHINX_RTD_THEME) @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/JuliaLanguage.qhc" -devhelp: juliadoc-pkg $(SPHINX_RTD_THEME) +devhelp: $(SPHINX_BUILD) $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @@ -118,68 +109,68 @@ devhelp: juliadoc-pkg $(SPHINX_RTD_THEME) @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/JuliaLanguage" @echo "# devhelp" -epub: juliadoc-pkg $(SPHINX_RTD_THEME) +epub: $(SPHINX_BUILD) $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." -latex: juliadoc-pkg $(SPHINX_RTD_THEME) +latex: $(SPHINX_BUILD) $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run 'make' in that directory to run these through (pdf)latex" \ "(use 'make latexpdf' here to do that automatically)." -latexpdf: juliadoc-pkg $(SPHINX_RTD_THEME) +latexpdf: $(SPHINX_BUILD) $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." -text: juliadoc-pkg $(SPHINX_RTD_THEME) +text: $(SPHINX_BUILD) $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." -man: juliadoc-pkg $(SPHINX_RTD_THEME) +man: $(SPHINX_BUILD) $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." -texinfo: juliadoc-pkg $(SPHINX_RTD_THEME) +texinfo: $(SPHINX_BUILD) $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run 'make' in that directory to run these through makeinfo" \ "(use 'make info' here to do that automatically)." -info: juliadoc-pkg $(SPHINX_RTD_THEME) +info: $(SPHINX_BUILD) $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." -gettext: juliadoc-pkg $(SPHINX_RTD_THEME) +gettext: $(SPHINX_BUILD) $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." -changes: juliadoc-pkg $(SPHINX_RTD_THEME) +changes: $(SPHINX_BUILD) $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." -linkcheck: juliadoc-pkg $(SPHINX_RTD_THEME) +linkcheck: $(SPHINX_BUILD) $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." -doctest: juliadoc-pkg $(SPHINX_RTD_THEME) +doctest: $(SPHINX_BUILD) PATH=$(PATH):$(build_bindir) $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." -helpdb.jl: stdlib/*.rst juliadoc-pkg $(SPHINX_RTD_THEME) - $(SPHINX_BUILD) -b jlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/jlhelp +helpdb.jl: stdlib/*.rst $(SPHINX_BUILD) + $(SPHINXBUILD) -b jlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/jlhelp mv $(BUILDDIR)/jlhelp/jlhelp.jl helpdb.jl diff --git a/doc/conf.py b/doc/conf.py index 9d37320bfc8773..4dac23a5ab39ef 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -13,13 +13,6 @@ import sys, os, re -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. - -juliadoc_dir = '{0}/juliadoc/'.format(os.path.abspath('.')) -sys.path.append(juliadoc_dir) - import juliadoc import sphinx_rtd_theme diff --git a/doc/juliadoc b/doc/juliadoc deleted file mode 160000 index bab3c6ba9e613d..00000000000000 --- a/doc/juliadoc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bab3c6ba9e613da94001e1d71f994143814a1422 From ca362a45b3aee4454de29b2aab43780885847558 Mon Sep 17 00:00:00 2001 From: Mike Nolta Date: Mon, 6 Oct 2014 17:43:40 -0400 Subject: [PATCH 07/25] doc: upgrade sphinx 1.1.3 -> 1.2.3 Fixes #8596, fixes #8276. --- doc/Makefile | 2 +- doc/helpdb.jl | 137 ++++++++++++++++++++++++------------------- doc/requirements.txt | 4 +- 3 files changed, 80 insertions(+), 63 deletions(-) diff --git a/doc/Makefile b/doc/Makefile index fb43775ea6df96..bb034b26b8c7b5 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -23,7 +23,7 @@ $(ACTIVATE): touch -c $@ $(SPHINX_BUILD): $(ACTIVATE) requirements.txt - . $(ACTIVATE) && pip install sphinx==1.1.3 \ + . $(ACTIVATE) && pip install sphinx==1.2.3 \ && pip install -r requirements.txt touch -c $@ diff --git a/doc/helpdb.jl b/doc/helpdb.jl index 1fe19e17c06325..d8fc20d0cb9a2f 100644 --- a/doc/helpdb.jl +++ b/doc/helpdb.jl @@ -209,7 +209,7 @@ "), -("Base","≡","is(x, y) -> Bool +("Base","is","is(x, y) -> Bool ===(x, y) -> Bool ≡(x, y) -> Bool @@ -837,7 +837,7 @@ "), -("Base","∌","in(item, collection) -> Bool +("Base","in","in(item, collection) -> Bool ∈(item, collection) -> Bool ∋(collection, item) -> Bool ∉(item, collection) -> Bool @@ -1291,7 +1291,7 @@ "), -("Base","⊊","issubset(a, b) +("Base","issubset","issubset(a, b) ⊆(A, S) -> Bool ⊈(A, S) -> Bool ⊊(A, S) -> Bool @@ -1333,13 +1333,15 @@ "), -("Base","Dict","Dict() +("Base","Dict","Dict([itr]) - \"Dict{K,V}()\" constructs a hash + \"Dict{K,V}()\" constructs a hash table with keys of type K and + values of type V. Given a single iterable argument, constructs a + \"Dict\" whose key-value pairs are taken from 2-tuples + \"(key,value)\" generated by the argument. - table with keys of type K and values of type V. The literal syntax - is \"{\"A\"=>1, \"B\"=>2}\" for a \"Dict{Any,Any}\", or - \"[\"A\"=>1, \"B\"=>2]\" for a \"Dict\" of inferred type. + Alternatively, a sequence of pair arguments may be passed: + \"Dict{K,V}(\"A\"=>1, \"B\"=>2)\". "), @@ -1465,7 +1467,7 @@ "), -("Base","∪","union(s1, s2...) +("Base","union","union(s1, s2...) ∪(s1, s2) Construct the union of two or more sets. Maintains order with @@ -1479,7 +1481,7 @@ "), -("Base","∩","intersect(s1, s2...) +("Base","intersect","intersect(s1, s2...) ∩(s1, s2) Construct the intersection of two or more sets. Maintains order and @@ -1551,7 +1553,7 @@ "), -("Base","⊆","issubset(A, S) -> Bool +("Base","issubset","issubset(A, S) -> Bool ⊆(A, S) -> Bool True if A is a subset of or equal to S. @@ -1773,10 +1775,10 @@ * \"casefold=true\": perform Unicode case folding, e.g. for case- insensitive string comparison - * \"newline2lf=true\", \"newline2ls=true\", or \"newline2ps=true\": - convert various newline sequences (LF, CRLF, CR, NEL) into a - linefeed (LF), line-separation (LS), or paragraph-separation (PS) - character, respectively + * \"newline2lf=true\", \"newline2ls=true\", or + \"newline2ps=true\": convert various newline sequences (LF, CRLF, + CR, NEL) into a linefeed (LF), line-separation (LS), or + paragraph-separation (PS) character, respectively * \"stripmark=true\": strip diacritical marks (e.g. accents) @@ -3601,7 +3603,7 @@ popdisplay(d::Display) "), -("Base","÷","div(a, b) +("Base","div","div(a, b) ÷(a, b) Compute a/b, truncating to an integer. @@ -3760,7 +3762,7 @@ popdisplay(d::Display) "), -("Base","≠","!=(x, y) +("Base","!=","!=(x, y) ≠(x, y) Not-equals comparison operator. Always gives the opposite answer as @@ -3769,14 +3771,14 @@ popdisplay(d::Display) "), -("Base","≡","===(x, y) +("Base","===","===(x, y) ≡(x, y) See the \"is()\" operator "), -("Base","≢","!==(x, y) +("Base","!==","!==(x, y) ≢(x, y) Equivalent to \"!is(x, y)\" @@ -3793,7 +3795,7 @@ popdisplay(d::Display) "), -("Base","≤","<=(x, y) +("Base","<=","<=(x, y) ≤(x, y) Less-than-or-equals comparison operator. @@ -3808,7 +3810,7 @@ popdisplay(d::Display) "), -("Base","≥",">=(x, y) +("Base",">=",">=(x, y) ≥(x, y) Greater-than-or-equals comparison operator. @@ -3821,7 +3823,7 @@ popdisplay(d::Display) "), -("Base",".≠",".!=(x, y) +("Base",".!=",".!=(x, y) .≠(x, y) Element-wise not-equals comparison operator. @@ -3834,7 +3836,7 @@ popdisplay(d::Display) "), -("Base",".≤",".<=(x, y) +("Base",".<=",".<=(x, y) .≤(x, y) Element-wise less-than-or-equals comparison operator. @@ -3847,7 +3849,7 @@ popdisplay(d::Display) "), -("Base",".≥",".>=(x, y) +("Base",".>=",".>=(x, y) .≥(x, y) Element-wise greater-than-or-equals comparison operator. @@ -4700,12 +4702,13 @@ popdisplay(d::Display) julia> gcdx(240, 46) (2,-9,47) - Note: Bézout coefficients are *not* uniquely defined. \"gcdx\" returns - the minimal Bézout coefficients that are computed by the extended - Euclid algorithm. (Ref: D. Knuth, TAoCP, 2/e, p. 325, Algorithm - X.) These coefficients \"u\" and \"v\" are minimal in the sense - that |u| < |\\frac y d and |v| < |\\frac x d. Furthermore, the - signs of \"u\" and \"v\" are chosen so that \"d\" is positive. + Note: Bézout coefficients are *not* uniquely defined. \"gcdx\" + returns the minimal Bézout coefficients that are computed by the + extended Euclid algorithm. (Ref: D. Knuth, TAoCP, 2/e, p. 325, + Algorithm X.) These coefficients \"u\" and \"v\" are minimal in + the sense that |u| < |\\frac y d and |v| < |\\frac x d. + Furthermore, the signs of \"u\" and \"v\" are chosen so that + \"d\" is positive. "), @@ -5359,7 +5362,7 @@ popdisplay(d::Display) "), -("Base","π","pi +("Base","pi","pi π The constant pi @@ -7773,8 +7776,8 @@ popdisplay(d::Display) Creates a symbolic link to \"target\" with the name \"link\". - Note: This function raises an error under operating systems that do not - support soft symbolic links, such as Windows XP. + Note: This function raises an error under operating systems that + do not support soft symbolic links, such as Windows XP. "), @@ -9067,7 +9070,7 @@ popdisplay(d::Display) "), -("Dates","millisecond","year(dt::TimeType) -> Int64 +("Dates","year","year(dt::TimeType) -> Int64 month(dt::TimeType) -> Int64 week(dt::TimeType) -> Int64 day(dt::TimeType) -> Int64 @@ -9080,7 +9083,7 @@ millisecond(dt::TimeType) -> Int64 "), -("Dates","Millisecond","Year(dt::TimeType) -> Year +("Dates","Year","Year(dt::TimeType) -> Year Month(dt::TimeType) -> Month Week(dt::TimeType) -> Week Day(dt::TimeType) -> Day @@ -9329,7 +9332,7 @@ Millisecond(dt::TimeType) -> Millisecond "), -("Dates","Millisecond","Year(v) +("Dates","Year","Year(v) Month(v) Week(v) Day(v) @@ -9779,7 +9782,7 @@ Millisecond(v) "), -("Base","⋅","dot(x, y) +("Base","dot","dot(x, y) ⋅(x, y) Compute the dot product. For complex vectors, the first vector is @@ -9787,7 +9790,7 @@ Millisecond(v) "), -("Base","×","cross(x, y) +("Base","cross","cross(x, y) ×(x, y) Compute the cross product of two 3-vectors. @@ -9851,23 +9854,33 @@ Millisecond(v) +-------------+-----------------------------------------+--------+--------------------------+---------------+ | Component | Description | \\\"LU\\\" | \\\"LU{T,Tridiagonal{T}}\\\" | \\\"UmfpackLU\\\" | +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | \\\"F[:L]\\\" | \\\"L\\\" (lower triangular) part of \\\"LU\\\" | ✓ | | ✓ | +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | \\\"F[:U]\\\" | \\\"U\\\" (upper triangular) part of \\\"LU\\\" | ✓ | | ✓ | +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | \\\"F[:p]\\\" | (right) permutation \\\"Vector\\\" | ✓ | | ✓ | +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | \\\"F[:P]\\\" | (right) permutation \\\"Matrix\\\" | ✓ | | | +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | \\\"F[:q]\\\" | left permutation \\\"Vector\\\" | | | ✓ | +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | \\\"F[:Rs]\\\" | \\\"Vector\\\" of scaling factors | | | ✓ | +-------------+-----------------------------------------+--------+--------------------------+---------------+ + | \\\"F[:(:)]\\\" | \\\"(L,U,p,q,Rs)\\\" components | | | ✓ | +-------------+-----------------------------------------+--------+--------------------------+---------------+ +--------------------+--------+--------------------------+---------------+ | Supported function | \\\"LU\\\" | \\\"LU{T,Tridiagonal{T}}\\\" | \\\"UmfpackLU\\\" | +--------------------+--------+--------------------------+---------------+ + | \\\"/\\\" | ✓ | | | +--------------------+--------+--------------------------+---------------+ | \\\"\\\\\\\" | ✓ | ✓ | ✓ | +--------------------+--------+--------------------------+---------------+ + | \\\"cond\\\" | ✓ | | ✓ | +--------------------+--------+--------------------------+---------------+ | \\\"det\\\" | ✓ | ✓ | ✓ | +--------------------+--------+--------------------------+---------------+ + | \\\"size\\\" | ✓ | ✓ | | +--------------------+--------+--------------------------+---------------+ "), @@ -9978,7 +9991,9 @@ Millisecond(v) +-------------+-----------------------------------------------+--------------------+-----------------------+--------------------+ | \\\"F[:R]\\\" | \\\"R\\\" (upper right triangular) part of \\\"QR\\\" | ✓ | ✓ | ✓ | +-------------+-----------------------------------------------+--------------------+-----------------------+--------------------+ + | \\\"F[:p]\\\" | pivot \\\"Vector\\\" | | | ✓ | +-------------+-----------------------------------------------+--------------------+-----------------------+--------------------+ + | \\\"F[:P]\\\" | (pivot) permutation \\\"Matrix\\\" | | | ✓ | +-------------+-----------------------------------------------+--------------------+-----------------------+--------------------+ The following functions are available for the \"QR\" objects: @@ -9991,13 +10006,13 @@ Millisecond(v) \"Q\" matrix can be converted into a regular matrix with \"full()\" which has a named argument \"thin\". - Note: \"qrfact\" returns multiple types because LAPACK uses several - representations that minimize the memory storage requirements of - products of Householder elementary reflectors, so that the \"Q\" - and \"R\" matrices can be stored compactly rather as two separate - dense matrices.The data contained in \"QR\" or \"QRPivoted\" can - be used to construct the \"QRPackedQ\" type, which is a compact - representation of the rotation matrix: + Note: \"qrfact\" returns multiple types because LAPACK uses + several representations that minimize the memory storage + requirements of products of Householder elementary reflectors, so + that the \"Q\" and \"R\" matrices can be stored compactly rather + as two separate dense matrices.The data contained in \"QR\" or + \"QRPivoted\" can be used to construct the \"QRPackedQ\" type, + which is a compact representation of the rotation matrix: Q = \\prod_{i=1}^{\\min(m,n)} (I - \\tau_i v_i v_i^T) @@ -10015,14 +10030,15 @@ Millisecond(v) representation [Bischof1987]. (The LAPACK documentation uses \"V\" in lieu of \"Y\".) - [Bischof1987] C Bischof and C Van Loan, The WY representation for - products of Householder matrices, SIAM J Sci Stat - Comput 8 (1987), s2-s13. doi:10.1137/0908009 + [Bischof1987] C Bischof and C Van Loan, The WY + representation for products of Householder matrices, + SIAM J Sci Stat Comput 8 (1987), s2-s13. + doi:10.1137/0908009 - [Schreiber1989] R Schreiber and C Van Loan, A storage-efficient WY - representation for products of Householder - transformations, SIAM J Sci Stat Comput 10 (1989), - 53-57. doi:10.1137/0910005 + [Schreiber1989] R Schreiber and C Van Loan, A + storage-efficient WY representation for products of + Householder transformations, SIAM J Sci Stat Comput + 10 (1989), 53-57. doi:10.1137/0910005 "), @@ -10700,7 +10716,8 @@ Millisecond(v) problems and \"nev+2 <= ncv <= n\" for other problems; default is \"ncv = max(20,2*nev+1)\". - * \"which\": type of eigenvalues to compute. See the note below. + * \"which\": type of eigenvalues to compute. See the note + below. +-----------+-----------------------------------------------------------------------------------------------------------------------------+ | \\\"which\\\" | type of eigenvalues | @@ -10730,8 +10747,8 @@ Millisecond(v) (forward) iterations. Otherwise, find eigenvalues close to \"sigma\" using shift and invert iterations. - * \"ritzvec\": Returns the Ritz vectors \"v\" (eigenvectors) if - \"true\" + * \"ritzvec\": Returns the Ritz vectors \"v\" (eigenvectors) + if \"true\" * \"v0\": starting vector from which to start the iterations @@ -10741,11 +10758,11 @@ Millisecond(v) \"niter\" and the number of matrix vector multiplications \"nmult\", as well as the final residual vector \"resid\". - Note: The \"sigma\" and \"which\" keywords interact: the description of - eigenvalues searched for by \"which\" do _not_ necessarily refer - to the eigenvalues of \"A\", but rather the linear operator - constructed by the specification of the iteration mode implied by - \"sigma\". + Note: The \"sigma\" and \"which\" keywords interact: the + description of eigenvalues searched for by \"which\" do _not_ + necessarily refer to the eigenvalues of \"A\", but rather the + linear operator constructed by the specification of the iteration + mode implied by \"sigma\". +-----------------+------------------------------------+------------------------------------+ | \\\"sigma\\\" | iteration mode | \\\"which\\\" refers to eigenvalues of | diff --git a/doc/requirements.txt b/doc/requirements.txt index 6e0416e70da76c..ac2f966b432887 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,2 +1,2 @@ --e git+https://github.com/JuliaLang/JuliaDoc.git#egg=JuliaDoc --e git+https://github.com/snide/sphinx_rtd_theme.git#egg=sphinx_rtd_theme +-e git+https://github.com/JuliaLang/JuliaDoc.git@0dd9903f12f21140d46ceae9b30088ec40e353d6#egg=JuliaDoc +-e git+https://github.com/snide/sphinx_rtd_theme.git@21e875d3a53ce897089ad690d897252f6063349d#egg=sphinx_rtd_theme From 7abd0876df1b61ee28595f93d48afa7adad28797 Mon Sep 17 00:00:00 2001 From: jake bolewski Date: Tue, 7 Oct 2014 16:30:57 -0400 Subject: [PATCH 08/25] fix disasm.cpp unused variable warnings, clean up a bit --- src/disasm.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/disasm.cpp b/src/disasm.cpp index 7954a8df1f1158..a10d83d06aa970 100644 --- a/src/disasm.cpp +++ b/src/disasm.cpp @@ -156,8 +156,8 @@ void jl_dump_function_asm(void *Fptr, size_t Fsize, IP, CE, MAB, ShowInst)); Streamer->InitSections(); -#ifndef USE_MCJIT -// LLVM33 version +#ifndef USE_MCJIT // LLVM33 version + // Make the MemoryObject wrapper FuncMCView memoryObject(Fptr, Fsize); @@ -168,11 +168,12 @@ void jl_dump_function_asm(void *Fptr, size_t Fsize, // Set up the line info typedef std::vector LInfoVec; LInfoVec::iterator lineIter = lineinfo.begin(); - lineIter = lineinfo.begin(); + LInfoVec::iterator lineEnd = lineinfo.end(); + uint64_t nextLineAddr = -1; DISubprogram debugscope; - if (lineIter != lineinfo.end()) { + if (lineIter != lineEnd) { nextLineAddr = (*lineIter).Address; debugscope = DISubprogram((*lineIter).Loc.getScope(jl_LLVMContext)); @@ -231,17 +232,17 @@ void jl_dump_function_asm(void *Fptr, size_t Fsize, DILineInfoTable lineinfo = di_ctx->getLineInfoForAddressRange((size_t)Fptr, Fsize); // Set up the line info - DILineInfoTable::iterator lines_iter = lineinfo.begin(); - DILineInfoTable::iterator lines_end = lineinfo.end(); + DILineInfoTable::iterator lineIter = lineinfo.begin(); + DILineInfoTable::iterator lineEnd = lineinfo.end(); uint64_t nextLineAddr = -1; - if (lines_iter != lineinfo.end()) { - nextLineAddr = lines_iter->first; + if (lineIter != lineEnd) { + nextLineAddr = lineIter->first; #ifdef LLVM35 - stream << "Filename: " << lines_iter->second.FileName << "\n"; + stream << "Filename: " << lineIter->second.FileName << "\n"; #else - stream << "Filename: " << lines_iter->second.getFileName() << "\n"; + stream << "Filename: " << lineIter->second.getFileName() << "\n"; #endif } @@ -255,11 +256,11 @@ void jl_dump_function_asm(void *Fptr, size_t Fsize, if (nextLineAddr != (uint64_t)-1 && absAddr == nextLineAddr) { #ifdef LLVM35 - stream << "Source line: " << lines_iter->second.Line << "\n"; + stream << "Source line: " << lineIter->second.Line << "\n"; #else - stream << "Source line: " << lines_iter->second.getLine() << "\n"; + stream << "Source line: " << lineIter->second.getLine() << "\n"; #endif - nextLineAddr = (++lines_iter)->first; + nextLineAddr = (++lineIter)->first; } MCInst Inst; From f765ad8040c58c7305d3ddcedd8ca556c2ae1d39 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Tue, 7 Oct 2014 21:15:06 +0100 Subject: [PATCH 09/25] remove bigfloat dependence from rationalize --- base/rational.jl | 80 ++++++++++++++++++++++-------------------------- test/numbers.jl | 36 +++++++++++++++++----- 2 files changed, 64 insertions(+), 52 deletions(-) diff --git a/base/rational.jl b/base/rational.jl index a830368cf2e311..abb6b2c47954ec 100644 --- a/base/rational.jl +++ b/base/rational.jl @@ -68,54 +68,46 @@ function rationalize{T<:Integer}(::Type{T}, x::FloatingPoint; tol::Real=eps(x)) tol < 0 && throw(ArgumentError("negative tolerance")) isnan(x) && return zero(T)//zero(T) isinf(x) && return (x < 0 ? -one(T) : one(T))//zero(T) - y = widen(x) - a::T = d::T = 1 - b::T = c::T = 0 - ok(r,s) = abs(oftype(x,r)/oftype(x,s) - x) <= tol - local n - const max_n = 1000 - for n = 0:max_n - local f::T, p::T, q::T - try - f = itrunc(T,y) - abs(y - f) < 1 || throw(InexactError()) # XXX: remove when #3040 is fixed - catch e - isa(e,InexactError) || rethrow(e) - n == 0 && return (x < 0 ? -one(T) : one(T))//zero(T) - break - end - y -= f + + p, q = (x < 0 ? -one(T) : one(T)), zero(T) + pp, qq = zero(T), one(T) + + x = abs(x) + a = trunc(x) + r = x-a + y = one(x) + + nt, t, tt = tol, zero(tol), zero(tol) + + while r > nt try - p = checked_add(checked_mul(f,a), c) - q = checked_add(checked_mul(f,b), d) + ia = convert(T,a) + p, pp = checked_add(checked_mul(ia,p),pp), p + q, qq = checked_add(checked_mul(ia,q),qq), q catch e - isa(e,OverflowError) || rethrow(e) - break - end - if y == 0 || ok(p, q) - if n > 0 && f > 1 - # check semi-convergents - u::T, v::T = iceil(T,f/2), f - p, q = u*a+c, u*b+d - ok(p, q) && return p//q - while u + 1 < v - m = div(u+v, 2) - p, q = m*a+c, m*b+d - if ok(p, q) - v = m - else - u = m - end - end - p, q = v*a+c, v*b+d - end - return p//q + isa(e,InexactError) || isa(e,OverflowError) || rethrow(e) + return p // q end - a, b, c, d = p, q, a, b - y = inv(y) + + t, tt = nt, t + x, y = y, r + + a, r = divrem(x,y) + nt = a*t + tt + end + + # find optimal semiconvergent + # smallest a such that x-a*y < a*t+tt + a = cld(x-tt,y+t) + try + ia = convert(T,a) + p = checked_add(checked_mul(ia,p),pp) + q = checked_add(checked_mul(ia,q),qq) + return p // q + catch e + isa(e,InexactError) || isa(e,OverflowError) || rethrow(e) + return p // q end - @assert n < max_n - return a//b end rationalize(x::FloatingPoint; kvs...) = rationalize(Int, x; kvs...) diff --git a/test/numbers.jl b/test/numbers.jl index 6ad56990b8f3eb..acc924cbc9ea8d 100644 --- a/test/numbers.jl +++ b/test/numbers.jl @@ -1608,14 +1608,34 @@ approx_eq(a, b) = approx_eq(a, b, 1e-6) @test isa(convert(Float64, big(1)//2), Float64) # issue 5935 -@test rationalize(Int64, nextfloat(0.1)) == 1//10 -@test rationalize(Int128,nextfloat(0.1)) == 1//10 -@test rationalize(BigInt,nextfloat(0.1)) == 1//10 -@test rationalize(BigInt,nextfloat(BigFloat("0.1"))) == 1//10 -@test rationalize(Int64, nextfloat(0.1),tol=0) == 379250494936463//3792504949364629 -@test rationalize(Int128,nextfloat(0.1),tol=0) == 379250494936463//3792504949364629 -@test rationalize(BigInt,nextfloat(0.1),tol=0) == 379250494936463//3792504949364629 -@test rationalize(BigInt,nextfloat(BigFloat("0.1")),tol=0) == 5449039493520762137579811059232372134271528690147791248915651012137088453645//54490394935207621375798110592323721342715286901477912489156510121370884536449 +@test rationalize(Int8, nextfloat(0.1)) == 1//10 +@test rationalize(Int64, nextfloat(0.1)) == 300239975158034//3002399751580339 +@test rationalize(Int128,nextfloat(0.1)) == 300239975158034//3002399751580339 +@test rationalize(BigInt,nextfloat(0.1)) == 300239975158034//3002399751580339 +@test rationalize(Int8, nextfloat(0.1),tol=0.5eps(0.1)) == 1//10 +@test rationalize(Int64, nextfloat(0.1),tol=0.5eps(0.1)) == 379250494936463//3792504949364629 +@test rationalize(Int128,nextfloat(0.1),tol=0.5eps(0.1)) == 379250494936463//3792504949364629 +@test rationalize(BigInt,nextfloat(0.1),tol=0.5eps(0.1)) == 379250494936463//3792504949364629 +@test rationalize(Int8, nextfloat(0.1),tol=1.5eps(0.1)) == 1//10 +@test rationalize(Int64, nextfloat(0.1),tol=1.5eps(0.1)) == 1//10 +@test rationalize(Int128,nextfloat(0.1),tol=1.5eps(0.1)) == 1//10 +@test rationalize(BigInt,nextfloat(0.1),tol=1.5eps(0.1)) == 1//10 +@test rationalize(BigInt,nextfloat(BigFloat("0.1")),tol=1.5eps(big(0.1))) == 1//10 +@test rationalize(Int64, nextfloat(0.1),tol=0) == 7205759403792795//72057594037927936 +@test rationalize(Int128,nextfloat(0.1),tol=0) == 7205759403792795//72057594037927936 +@test rationalize(BigInt,nextfloat(0.1),tol=0) == 7205759403792795//72057594037927936 + +@test rationalize(Int8, prevfloat(0.1)) == 1//10 +@test rationalize(Int64, prevfloat(0.1)) == 1//10 +@test rationalize(Int128,prevfloat(0.1)) == 1//10 +@test rationalize(BigInt,prevfloat(0.1)) == 1//10 +@test rationalize(BigInt,prevfloat(BigFloat("0.1"))) == 1//10 +@test rationalize(Int64, prevfloat(0.1),tol=0) == 7205759403792793//72057594037927936 +@test rationalize(Int128,prevfloat(0.1),tol=0) == 7205759403792793//72057594037927936 +@test rationalize(BigInt,prevfloat(0.1),tol=0) == 7205759403792793//72057594037927936 + +@test rationalize(BigInt,nextfloat(BigFloat("0.1")),tol=0) == 46316835694926478169428394003475163141307993866256225615783033603165251855975//463168356949264781694283940034751631413079938662562256157830336031652518559744 + @test rationalize(Int8, 200f0) == 1//0 @test rationalize(Int8, -200f0) == -1//0 From f1eca727264cb5837ba44eaaf6a42e2016983a1f Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Tue, 7 Oct 2014 21:55:20 +0100 Subject: [PATCH 10/25] fix try/catch error --- base/rational.jl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/base/rational.jl b/base/rational.jl index abb6b2c47954ec..ae732a5086e7a0 100644 --- a/base/rational.jl +++ b/base/rational.jl @@ -82,8 +82,10 @@ function rationalize{T<:Integer}(::Type{T}, x::FloatingPoint; tol::Real=eps(x)) while r > nt try ia = convert(T,a) - p, pp = checked_add(checked_mul(ia,p),pp), p - q, qq = checked_add(checked_mul(ia,q),qq), q + np = checked_add(checked_mul(ia,p),pp) + nq = checked_add(checked_mul(ia,q),qq) + p, pp = np, p + q, qq = nq, q catch e isa(e,InexactError) || isa(e,OverflowError) || rethrow(e) return p // q @@ -101,9 +103,9 @@ function rationalize{T<:Integer}(::Type{T}, x::FloatingPoint; tol::Real=eps(x)) a = cld(x-tt,y+t) try ia = convert(T,a) - p = checked_add(checked_mul(ia,p),pp) - q = checked_add(checked_mul(ia,q),qq) - return p // q + np = checked_add(checked_mul(ia,p),pp) + nq = checked_add(checked_mul(ia,q),qq) + return np // nq catch e isa(e,InexactError) || isa(e,OverflowError) || rethrow(e) return p // q From 38d0b1aa71eaf7440646f9485449a7d563248320 Mon Sep 17 00:00:00 2001 From: jake bolewski Date: Tue, 7 Oct 2014 17:10:48 -0400 Subject: [PATCH 11/25] fix some syntax deprecation warnings in perf --- test/perf/perfutil.jl | 2 +- test/perf/shootout/meteor_contest.jl | 8 ++++---- test/perf/shootout/revcomp.jl | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/perf/perfutil.jl b/test/perf/perfutil.jl index 4f80ceb6e54d2f..41a4c97c3deb09 100644 --- a/test/perf/perfutil.jl +++ b/test/perf/perfutil.jl @@ -38,7 +38,7 @@ function submit_to_codespeed(vals,name,desc,unit,test_group,lessisbetter=true) csdata["lessisbetter"] = lessisbetter println( "$name: $(mean(vals))" ) - ret = post( "http://$codespeed_host/result/add/json/", {"json" => json([csdata])} ) + ret = post( "http://$codespeed_host/result/add/json/", Dict("json" => json([csdata])) ) println( json([csdata]) ) if ret.http_code != 200 && ret.http_code != 202 error("Error submitting $name [HTTP code $(ret.http_code)], dumping headers and text: $(ret.headers)\n$(bytestring(ret.body))\n\n") diff --git a/test/perf/shootout/meteor_contest.jl b/test/perf/shootout/meteor_contest.jl index 43a0c73c5f69c2..ded3b22cc49fb4 100644 --- a/test/perf/shootout/meteor_contest.jl +++ b/test/perf/shootout/meteor_contest.jl @@ -15,17 +15,17 @@ const W = 3 const SW = 4 const SE = 5 -const rotate = {E => NE, NE => NW, NW => W, W => SW, SW => SE, SE => E} -const flip = {E => W, NE => NW, NW => NE, W => E, SW => SE, SE => SW} +const rotate = Dict(E => NE, NE => NW, NW => W, W => SW, SW => SE, SE => E) +const flip = Dict(E => W, NE => NW, NW => NE, W => E, SW => SE, SE => SW) -const move = { +const move = Dict( E => (x, y) -> (x + 1, y), W => (x, y) -> (x - 1, y), NE => (x, y) -> (x + y%2, y - 1), NW => (x, y) -> (x + y%2 - 1, y - 1), SE => (x, y) -> (x + y%2, y + 1), SW => (x, y) -> (x + y%2 - 1, y + 1) -} +) const pieces = ( (E, E, E, SE), diff --git a/test/perf/shootout/revcomp.jl b/test/perf/shootout/revcomp.jl index 2624c1db121347..58e9d15eec758b 100644 --- a/test/perf/shootout/revcomp.jl +++ b/test/perf/shootout/revcomp.jl @@ -6,7 +6,7 @@ # FIXME(davekong) Is there support in Julia for doing more efficient IO and # handling of byte arrays? -const revcompdata = { +const revcompdata = Dict( 'A'=> 'T', 'a'=> 'T', 'C'=> 'G', 'c'=> 'G', 'G'=> 'C', 'g'=> 'C', @@ -23,7 +23,7 @@ const revcompdata = { 'D'=> 'H', 'd'=> 'H', 'B'=> 'V', 'b'=> 'V', 'N'=> 'N', 'n'=> 'N', -} +) function print_buff(b) br = reverse(b) From e24fac0f1bb7200e1597d8e546cd445ce4fc0fc0 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 7 Oct 2014 18:00:05 -0400 Subject: [PATCH 12/25] Remove checknan option to median and update docs Fixes #8598, closes #8605, ref #6820 --- base/statistics.jl | 12 +++++------- doc/helpdb.jl | 13 ++++++------- doc/stdlib/base.rst | 12 +++++------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/base/statistics.jl b/base/statistics.jl index 83e5aeb7405f20..300624edf26391 100644 --- a/base/statistics.jl +++ b/base/statistics.jl @@ -455,10 +455,10 @@ middle(x::Real, y::Real) = (x + y) / 2 middle(a::Range) = middle(a[1], a[end]) middle(a::AbstractArray) = ((v1, v2) = extrema(a); middle(v1, v2)) -function median!{T}(v::AbstractVector{T}; checknan::Bool=true) +function median!{T}(v::AbstractVector{T}) isempty(v) && error("median of an empty array is undefined") - if checknan && T<:FloatingPoint - for x in v + if T<:FloatingPoint + @inbounds for x in v isnan(x) && return x end end @@ -471,10 +471,8 @@ function median!{T}(v::AbstractVector{T}; checknan::Bool=true) end end -median{T}(v::AbstractArray{T}; checknan::Bool=true) = - median!(vec(copy(v)), checknan=checknan) -median{T}(v::AbstractArray{T}, region; checknan::Bool=true) = - mapslices( x->median(x; checknan=checknan), v, region ) +median{T}(v::AbstractArray{T}) = median!(vec(copy(v))) +median{T}(v::AbstractArray{T}, region) = mapslices(median, v, region) # for now, use the R/S definition of quantile; may want variants later # see ?quantile in R -- this is type 7 diff --git a/doc/helpdb.jl b/doc/helpdb.jl index d8fc20d0cb9a2f..9ac2cbc44178b2 100644 --- a/doc/helpdb.jl +++ b/doc/helpdb.jl @@ -6612,17 +6612,16 @@ popdisplay(d::Display) "), -("Base","median","median(v; checknan::Bool=true) +("Base","median","median(v) - Compute the median of a vector \"v\". If keyword argument - \"checknan\" is true (the default), an error is raised for data - containing NaN values. Note: Julia does not ignore \"NaN\" values - in the computation. For applications requiring the handling of - missing data, the \"DataArray\" package is recommended. + Compute the median of a vector \"v\". \"NaN\" is returned if the + data contains any \"NaN\" values. For applications requiring the + handling of missing data, the \"DataArrays\" package is + recommended. "), -("Base","median!","median!(v; checknan::Bool=true) +("Base","median!","median!(v) Like \"median\", but may overwrite the input vector. diff --git a/doc/stdlib/base.rst b/doc/stdlib/base.rst index 7d63fb45019f24..5e1dfca01a0251 100644 --- a/doc/stdlib/base.rst +++ b/doc/stdlib/base.rst @@ -4561,15 +4561,13 @@ Statistics Compute the sample variance of a vector ``v`` with known mean ``m``. Note: Julia does not ignore ``NaN`` values in the computation. -.. function:: median(v; checknan::Bool=true) +.. function:: median(v) - Compute the median of a vector ``v``. If keyword argument ``checknan`` is true - (the default), an error is raised for data containing NaN values. - Note: Julia does not ignore ``NaN`` values in the computation. - For applications requiring the handling of missing data, the ``DataArray`` - package is recommended. + Compute the median of a vector ``v``. ``NaN`` is returned if the data + contains any ``NaN`` values. For applications requiring the handling of + missing data, the ``DataArrays`` package is recommended. -.. function:: median!(v; checknan::Bool=true) +.. function:: median!(v) Like ``median``, but may overwrite the input vector. From b296f6aaaf06c6517c74c48536f58f48bf53abba Mon Sep 17 00:00:00 2001 From: Paul Lange Date: Tue, 7 Oct 2014 20:56:42 +0200 Subject: [PATCH 13/25] Add appdata file --- Makefile | 3 +++ contrib/julia.appdata.xml | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 contrib/julia.appdata.xml diff --git a/Makefile b/Makefile index 649418e0f3f4bb..ca3174d91619e5 100644 --- a/Makefile +++ b/Makefile @@ -268,6 +268,9 @@ endif -gtk-update-icon-cache $(DESTDIR)$(datarootdir)/icons/hicolor/ mkdir -p $(DESTDIR)$(datarootdir)/applications/ $(INSTALL_F) contrib/julia.desktop $(DESTDIR)$(datarootdir)/applications/ + # Install appdata file + mkdir -p $(DESTDIR)$(datarootdir)/appdata/ + $(INSTALL_F) contrib/julia.appdata.xml $(DESTDIR)$(datarootdir)/appdata/ # Update RPATH entries and JL_SYSTEM_IMAGE_PATH if $(private_libdir_rel) != $(build_private_libdir_rel) ifneq ($(private_libdir_rel),$(build_private_libdir_rel)) diff --git a/contrib/julia.appdata.xml b/contrib/julia.appdata.xml new file mode 100644 index 00000000000000..aa36b84bf2a65c --- /dev/null +++ b/contrib/julia.appdata.xml @@ -0,0 +1,28 @@ + + + + julia.desktop + CC-BY-SA-3.0 + MIT and LGPL-2.1+ and GPL-2.0+ + +

+ Julia is a high-level, high-performance dynamic programming language for + technical computing, with syntax that is familiar to users of other + technical computing environments. It provides a sophisticated compiler, + distributed parallel execution, numerical accuracy, and an extensive + mathematical function library. +

+

+ The library, largely written in Julia itself, + also integrates mature, best-of-breed C and Fortran libraries for linear + algebra, random number generation, signal processing, and string processing. + In addition, the Julia developer community is contributing a number of + external packages through Julia’s built-in package manager at a rapid pace. +

+
+ + http://julialang.org/images/julia-gnome.png + + http://julialang.org/ + julia-dev@googlegroups.com +
From 2a35df6a62c5d8b6884d18e008a88beb677f3739 Mon Sep 17 00:00:00 2001 From: Will Kearney Date: Wed, 8 Oct 2014 07:58:48 -0400 Subject: [PATCH 14/25] Fix typo in similar error message --- base/linalg/triangular.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/linalg/triangular.jl b/base/linalg/triangular.jl index 2b5b7f135cd6e2..cc5769497ebb18 100644 --- a/base/linalg/triangular.jl +++ b/base/linalg/triangular.jl @@ -144,7 +144,7 @@ fill!(A::Triangular, x) = (fill!(A.data, x); A) function similar{T,S,UpLo,IsUnit,Tnew}(A::Triangular{T,S,UpLo,IsUnit}, ::Type{Tnew}, dims::Dims) dims[1] == dims[2] || throw(ArgumentError("a Triangular matrix must be square")) - length(dims) == 2 || throw(ArgumentError("a Traigular matrix must have two dimensions")) + length(dims) == 2 || throw(ArgumentError("a Triangular matrix must have two dimensions")) A = similar(A.data, Tnew, dims) return Triangular{Tnew, typeof(A), UpLo, IsUnit}(A) end From fbd44636e4647014a588aef60a6b2cca7a2b990c Mon Sep 17 00:00:00 2001 From: timholy Date: Wed, 8 Oct 2014 08:43:20 -0500 Subject: [PATCH 15/25] Fix profiler for Dict change; add basic "does it work at all?" tests --- base/profile.jl | 2 +- test/profile.jl | 14 ++++++++++++++ test/runtests.jl | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/profile.jl diff --git a/base/profile.jl b/base/profile.jl index d2c12f2698943d..57fb4bb461674f 100644 --- a/base/profile.jl +++ b/base/profile.jl @@ -63,7 +63,7 @@ end function getdict(data::Vector{Uint}) uip = unique(data) - Dict(uip, [lookup(ip) for ip in uip]) + Dict{Uint, LineInfo}([ip=>lookup(ip) for ip in uip]) end function callers(funcname::ByteString, bt::Vector{Uint}, lidict; filename = nothing, linerange = nothing) diff --git a/test/profile.jl b/test/profile.jl new file mode 100644 index 00000000000000..245f9d4d8b5f4d --- /dev/null +++ b/test/profile.jl @@ -0,0 +1,14 @@ +@profile sleep(0.1) +let iobuf = IOBuffer() + Profile.print(iobuf) + str = takebuf_string(iobuf) + @test !isempty(str) + Profile.print(iobuf, format=:flat) + str = takebuf_string(iobuf) + @test !isempty(str) + Profile.print(iobuf, format=:tree, C=true) + str = takebuf_string(iobuf) + @test !isempty(str) + Profile.clear() + @test isempty(Profile.fetch()) +end diff --git a/test/runtests.jl b/test/runtests.jl index 6d51abeaf638c4..ad1e75631e545d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,7 +9,7 @@ testnames = [ "floatapprox", "readdlm", "reflection", "regex", "float16", "combinatorics", "sysinfo", "rounding", "ranges", "mod2pi", "euler", "show", "lineedit", "replcompletions", "repl", "test", "goto", - "llvmcall", "grisu", "nullable", "meta", "staged" + "llvmcall", "grisu", "nullable", "meta", "staged", "profile" ] if isdir(joinpath(dirname(@__FILE__), "..", "examples")) From 1299fbf64eb48ea868c39bffd85125d5a6a85eeb Mon Sep 17 00:00:00 2001 From: Jutho Haegeman Date: Wed, 8 Oct 2014 15:51:47 +0200 Subject: [PATCH 16/25] fix indexin for new Dict syntax --- base/array.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/array.jl b/base/array.jl index 67b832fcbed171..cb18f7e9c70eaa 100644 --- a/base/array.jl +++ b/base/array.jl @@ -1148,7 +1148,7 @@ indmin(a) = findmin(a)[2] # similar to Matlab's ismember # returns a vector containing the highest index in b for each value in a that is a member of b function indexin(a::AbstractArray, b::AbstractArray) - bdict = Dict(b, 1:length(b)) + bdict = Dict(zip(b, 1:length(b))) [get(bdict, i, 0) for i in a] end From 9a273ff212a08c3f1f2b014fdb863584886ee5b9 Mon Sep 17 00:00:00 2001 From: timholy Date: Wed, 8 Oct 2014 09:25:43 -0500 Subject: [PATCH 17/25] Reuse old arrays for empty!(::Dict). Closes #8558 --- base/dict.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/dict.jl b/base/dict.jl index eb3795b1fdcc90..0a4a319e7fce8d 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -468,8 +468,10 @@ end function empty!{K,V}(h::Dict{K,V}) fill!(h.slots, 0x0) sz = length(h.slots) - h.keys = Array(K, sz) - h.vals = Array(V, sz) + empty!(h.keys) + empty!(h.vals) + resize!(h.keys, sz) + resize!(h.vals, sz) h.ndel = 0 h.count = 0 return h From 6ae205ea7d5a7242bc1d2966ff84c9e942a7b705 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 8 Oct 2014 10:51:52 -0400 Subject: [PATCH 18/25] fix #8615, missing reverse in parsing vcat with ; --- src/julia-parser.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/julia-parser.scm b/src/julia-parser.scm index 85d789f17c9d38..ecd56e20ac195e 100644 --- a/src/julia-parser.scm +++ b/src/julia-parser.scm @@ -1426,7 +1426,7 @@ (if (eqv? (require-token s) closer) (loop lst nxt) (let ((params (parse-arglist s closer))) - `(vcat ,@params ,@lst ,nxt)))) + `(vcat ,@params ,@(reverse lst) ,nxt)))) ((#\] #\}) (error (string "unexpected \"" t "\""))) (else From 75344efb27b45d256a240b6b593ed8761779c06e Mon Sep 17 00:00:00 2001 From: Amit Murthy Date: Wed, 8 Oct 2014 20:27:22 +0530 Subject: [PATCH 19/25] docfix : add nullable-types --- doc/index.rst | 1 + doc/manual/index.rst | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/index.rst b/doc/index.rst index 7f4dda63fc6c00..5d21854e3229c2 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -37,6 +37,7 @@ manual/networking-and-streams manual/parallel-computing manual/dates + manual/nullable-types manual/running-external-programs manual/calling-c-and-fortran-code manual/interacting-with-julia diff --git a/doc/manual/index.rst b/doc/manual/index.rst index 7e5551a89c9ca9..8ad135934ee2bf 100644 --- a/doc/manual/index.rst +++ b/doc/manual/index.rst @@ -28,6 +28,7 @@ linear-algebra networking-and-streams parallel-computing + dates nullable-types interacting-with-julia running-external-programs From aa9f6999a0d571483fe9db3aa1dfd18a5b4c5472 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 8 Oct 2014 11:22:02 -0400 Subject: [PATCH 20/25] remove localize_vars from `@schedule`. ref #8591 There really needs to be some macro that does this kind of thing without playing games with your variables. --- base/multi.jl | 28 +++++++++++++++++----------- base/task.jl | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/base/multi.jl b/base/multi.jl index 4deec51e5ec42b..350ad5a1ca6409 100644 --- a/base/multi.jl +++ b/base/multi.jl @@ -797,7 +797,7 @@ function accept_handler(server::TCPServer, status::Int32) end function create_message_handler_loop(sock::AsyncStream; ntfy_join_complete=nothing) #returns immediately - schedule(@task begin + @schedule begin global PGRP #println("message_handler_loop") disable_nagle(sock) @@ -823,26 +823,32 @@ function create_message_handler_loop(sock::AsyncStream; ntfy_join_complete=nothi id = deserialize(sock) f = deserialize(sock) args = deserialize(sock) - @schedule begin - v = run_work_thunk(()->f(args...)) - deliver_result(sock, msg, id, v) - v + let f=f, args=args, id=id, msg=msg + @schedule begin + v = run_work_thunk(()->f(args...)) + deliver_result(sock, msg, id, v) + v + end end elseif is(msg, :call_wait) id = deserialize(sock) notify_id = deserialize(sock) f = deserialize(sock) args = deserialize(sock) - @schedule begin - rv = schedule_call(id, ()->f(args...)) - deliver_result(sock, msg, notify_id, wait_full(rv)) + let f=f, args=args, id=id, msg=msg, notify_id=notify_id + @schedule begin + rv = schedule_call(id, ()->f(args...)) + deliver_result(sock, msg, notify_id, wait_full(rv)) + end end elseif is(msg, :do) f = deserialize(sock) args = deserialize(sock) #print("got args: $args\n") - @schedule begin - run_work_thunk(RemoteValue(), ()->f(args...)) + let f=f, args=args + @schedule begin + run_work_thunk(RemoteValue(), ()->f(args...)) + end end elseif is(msg, :result) # used to deliver result of wait or fetch @@ -924,7 +930,7 @@ function create_message_handler_loop(sock::AsyncStream; ntfy_join_complete=nothi return nothing end - end) + end end function disable_threaded_libs() diff --git a/base/task.jl b/base/task.jl index f486b762939cce..e2de76581c344e 100644 --- a/base/task.jl +++ b/base/task.jl @@ -233,7 +233,7 @@ end # schedule an expression to run asynchronously, with minimal ceremony macro schedule(expr) - expr = localize_vars(:(()->($expr)), false) + expr = :(()->($expr)) :(enq_work(Task($(esc(expr))))) end From 793cf3ee74de0136211fa13ba05a9ce52767a17d Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 8 Oct 2014 13:40:57 -0400 Subject: [PATCH 21/25] Add deprecations for checknan keyword argument and add to NEWS.md --- NEWS.md | 19 +++++++++++++------ base/deprecated.jl | 4 ++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 4dce228bc54b1a..ba10061bbd3007 100644 --- a/NEWS.md +++ b/NEWS.md @@ -68,6 +68,11 @@ Library improvements * `deepcopy` recurses through immutable types and makes copies of their mutable fields ([#8560]). +Deprecated or removed +--------------------- + + * `median` and `median!` no longer accept a `checknan` keyword argument ([#8605]). + Julia v0.3.0 Release Notes ========================== @@ -852,6 +857,7 @@ Too numerous to mention. [#3688]: https://github.com/JuliaLang/julia/issues/3688 [#3697]: https://github.com/JuliaLang/julia/issues/3697 [#3719]: https://github.com/JuliaLang/julia/issues/3719 +[#3759]: https://github.com/JuliaLang/julia/issues/3759 [#3790]: https://github.com/JuliaLang/julia/issues/3790 [#3819]: https://github.com/JuliaLang/julia/issues/3819 [#3872]: https://github.com/JuliaLang/julia/issues/3872 @@ -913,6 +919,7 @@ Too numerous to mention. [#5381]: https://github.com/JuliaLang/julia/issues/5381 [#5387]: https://github.com/JuliaLang/julia/issues/5387 [#5403]: https://github.com/JuliaLang/julia/issues/5403 +[#5413]: https://github.com/JuliaLang/julia/issues/5413 [#5423]: https://github.com/JuliaLang/julia/issues/5423 [#5427]: https://github.com/JuliaLang/julia/issues/5427 [#5428]: https://github.com/JuliaLang/julia/issues/5428 @@ -962,6 +969,7 @@ Too numerous to mention. [#6678]: https://github.com/JuliaLang/julia/issues/6678 [#6716]: https://github.com/JuliaLang/julia/issues/6716 [#6726]: https://github.com/JuliaLang/julia/issues/6726 +[#6739]: https://github.com/JuliaLang/julia/issues/6739 [#6769]: https://github.com/JuliaLang/julia/issues/6769 [#6773]: https://github.com/JuliaLang/julia/issues/6773 [#6911]: https://github.com/JuliaLang/julia/issues/6911 @@ -981,6 +989,7 @@ Too numerous to mention. [#7146]: https://github.com/JuliaLang/julia/issues/7146 [#7236]: https://github.com/JuliaLang/julia/issues/7236 [#7242]: https://github.com/JuliaLang/julia/issues/7242 +[#7311]: https://github.com/JuliaLang/julia/issues/7311 [#7359]: https://github.com/JuliaLang/julia/issues/7359 [#7365]: https://github.com/JuliaLang/julia/issues/7365 [#7373]: https://github.com/JuliaLang/julia/issues/7373 @@ -990,14 +999,12 @@ Too numerous to mention. [#7513]: https://github.com/JuliaLang/julia/issues/7513 [#7647]: https://github.com/JuliaLang/julia/issues/7647 [#7654]: https://github.com/JuliaLang/julia/issues/7654 +[#7704]: https://github.com/JuliaLang/julia/issues/7704 [#7917]: https://github.com/JuliaLang/julia/issues/7917 [#7992]: https://github.com/JuliaLang/julia/issues/7992 [#8011]: https://github.com/JuliaLang/julia/issues/8011 [#8089]: https://github.com/JuliaLang/julia/issues/8089 -[#7704]: https://github.com/JuliaLang/julia/issues/7704 -[#5413]: https://github.com/JuliaLang/julia/issues/5413 -[#3759]: https://github.com/JuliaLang/julia/issues/3759 -[#7311]: https://github.com/JuliaLang/julia/issues/7311 +[#8152]: https://github.com/JuliaLang/julia/issues/8152 [#8423]: https://github.com/JuliaLang/julia/issues/8423 -[#8152]: https://github.com/JuliaLang/julia/pull/8152 -[#6739]: https://github.com/JuliaLang/julia/issues/6739 +[#8560]: https://github.com/JuliaLang/julia/issues/8560 +[#8605]: https://github.com/JuliaLang/julia/issues/8605 diff --git a/base/deprecated.jl b/base/deprecated.jl index 466e270d5b3894..1da2517be797dd 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -185,3 +185,7 @@ const Nothing = Void export None const None = Union() + +@deprecate median(v::AbstractArray; checknan::Bool=true) median(v) +@deprecate median(v::AbstractArray, region; checknan::Bool=true) median(v, region) +@deprecate median!(v::AbstractVector; checknan::Bool=true) median!(v) From 8cdc741412114f7f3bc92cb2f949a721a69f4d96 Mon Sep 17 00:00:00 2001 From: timholy Date: Wed, 8 Oct 2014 14:08:09 -0500 Subject: [PATCH 22/25] Convert profile test to busywait to avoid Travis failures --- test/profile.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/profile.jl b/test/profile.jl index 245f9d4d8b5f4d..4f4452606ca464 100644 --- a/test/profile.jl +++ b/test/profile.jl @@ -1,4 +1,9 @@ -@profile sleep(0.1) +function busywait(t) + tend = time() + t + while time() < tend end +end + +@profile busywait(1) let iobuf = IOBuffer() Profile.print(iobuf) str = takebuf_string(iobuf) From 9ba950d860d32f6a1889b9f0fa8479ea55375699 Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Wed, 8 Oct 2014 14:08:12 -0400 Subject: [PATCH 23/25] Fix #8616. Check that input matrix is square in Triangular and a test. Let linalg error messages start with small letters --- base/linalg.jl | 8 ++++---- base/linalg/factorization.jl | 18 +++++++++--------- base/linalg/triangular.jl | 1 + test/linalg/triangular.jl | 4 +++- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/base/linalg.jl b/base/linalg.jl index bf29a3915fe47e..dc3e6c88d42f98 100644 --- a/base/linalg.jl +++ b/base/linalg.jl @@ -162,21 +162,21 @@ end #Check that stride of matrix/vector is 1 function chkstride1(A::StridedVecOrMat...) for a in A - stride(a,1)== 1 || error("Matrix does not have contiguous columns") + stride(a,1)== 1 || error("matrix does not have contiguous columns") end end #Check that matrix is square function chksquare(A::AbstractMatrix) m,n = size(A) - m == n || throw(DimensionMismatch("Matrix is not square")) + m == n || throw(DimensionMismatch("matrix is not square")) m end function chksquare(A...) - sizes=Int[] + sizes = Int[] for a in A - size(a,1)==size(a,2) || throw(DimensionMismatch("Matrix is not square: dimensions are $(size(a))")) + size(a,1)==size(a,2) || throw(DimensionMismatch("matrix is not square: dimensions are $(size(a))")) push!(sizes, size(a,1)) end length(A)==1 ? sizes[1] : sizes diff --git a/base/linalg/factorization.jl b/base/linalg/factorization.jl index 3366f08169cce6..44a09d6e381fc1 100644 --- a/base/linalg/factorization.jl +++ b/base/linalg/factorization.jl @@ -21,9 +21,9 @@ end # Note. For QRCompactWY factorization without pivoting, the WY representation based method introduced in LAPACK 3.4 immutable QRCompactWY{S} <: Factorization{S} factors::Matrix{S} - T::Triangular{S} + T::Matrix{S} end -QRCompactWY{S}(factors::Matrix{S}, T::Matrix{S})=QRCompactWY{S}(factors, Triangular(T, :U)) +QRCompactWY{S}(factors::Matrix{S}, T::Matrix{S})=QRCompactWY{S}(factors, T) immutable QRPivoted{T} <: Factorization{T} factors::Matrix{T} @@ -113,7 +113,7 @@ immutable QRPackedQ{T} <: AbstractMatrix{T} end immutable QRCompactWYQ{S} <: AbstractMatrix{S} factors::Matrix{S} - T::Triangular{S} + T::Matrix{S} end convert{T}(::Type{QRPackedQ{T}}, Q::QRPackedQ) = QRPackedQ(convert(AbstractMatrix{T}, Q.factors), convert(Vector{T}, Q.τ)) @@ -130,7 +130,7 @@ full{T}(A::Union(QRPackedQ{T},QRCompactWYQ{T}); thin::Bool=true) = A_mul_B!(A, t ## Multiplication by Q ### QB -A_mul_B!{T<:BlasFloat}(A::QRCompactWYQ{T}, B::StridedVecOrMat{T}) = LAPACK.gemqrt!('L','N',A.factors,A.T.data,B) +A_mul_B!{T<:BlasFloat}(A::QRCompactWYQ{T}, B::StridedVecOrMat{T}) = LAPACK.gemqrt!('L','N',A.factors,A.T,B) A_mul_B!{T<:BlasFloat}(A::QRPackedQ{T}, B::StridedVecOrMat{T}) = LAPACK.ormqr!('L','N',A.factors,A.τ,B) function A_mul_B!{T}(A::QRPackedQ{T}, B::AbstractVecOrMat{T}) mA, nA = size(A.factors) @@ -167,8 +167,8 @@ function *{TA,TB}(A::Union(QRPackedQ{TA},QRCompactWYQ{TA}), B::StridedMatrix{TB} A_mul_B!(Anew,Bnew) end ### QcB -Ac_mul_B!{T<:BlasReal}(A::QRCompactWYQ{T}, B::StridedVecOrMat{T}) = LAPACK.gemqrt!('L','T',A.factors,A.T.data,B) -Ac_mul_B!{T<:BlasComplex}(A::QRCompactWYQ{T}, B::StridedVecOrMat{T}) = LAPACK.gemqrt!('L','C',A.factors,A.T.data,B) +Ac_mul_B!{T<:BlasReal}(A::QRCompactWYQ{T}, B::StridedVecOrMat{T}) = LAPACK.gemqrt!('L','T',A.factors,A.T,B) +Ac_mul_B!{T<:BlasComplex}(A::QRCompactWYQ{T}, B::StridedVecOrMat{T}) = LAPACK.gemqrt!('L','C',A.factors,A.T,B) Ac_mul_B!{T<:BlasReal}(A::QRPackedQ{T}, B::StridedVecOrMat{T}) = LAPACK.ormqr!('L','T',A.factors,A.τ,B) Ac_mul_B!{T<:BlasComplex}(A::QRPackedQ{T}, B::StridedVecOrMat{T}) = LAPACK.ormqr!('L','C',A.factors,A.τ,B) function Ac_mul_B!{T}(A::QRPackedQ{T}, B::AbstractVecOrMat{T}) @@ -198,7 +198,7 @@ function Ac_mul_B{TQ<:Number,TB<:Number,N}(Q::Union(QRPackedQ{TQ},QRCompactWYQ{T Ac_mul_B!(convert(AbstractMatrix{TQB}, Q), TB == TQB ? copy(B) : convert(AbstractArray{TQB,N}, B)) end ### AQ -A_mul_B!{T<:BlasFloat}(A::StridedVecOrMat{T}, B::QRCompactWYQ{T}) = LAPACK.gemqrt!('R','N', B.factors, B.T.data, A) +A_mul_B!{T<:BlasFloat}(A::StridedVecOrMat{T}, B::QRCompactWYQ{T}) = LAPACK.gemqrt!('R','N', B.factors, B.T, A) A_mul_B!(A::StridedVecOrMat, B::QRPackedQ) = LAPACK.ormqr!('R', 'N', B.factors, B.τ, A) function A_mul_B!{T}(A::StridedMatrix{T},Q::QRPackedQ{T}) mQ, nQ = size(Q.factors) @@ -227,8 +227,8 @@ function *{TA,TQ,N}(A::StridedArray{TA,N}, Q::Union(QRPackedQ{TQ},QRCompactWYQ{T A_mul_B!(TA==TAQ ? copy(A) : convert(AbstractArray{TAQ,N}, A), convert(AbstractMatrix{TAQ}, Q)) end ### AQc -A_mul_Bc!{T<:BlasReal}(A::StridedVecOrMat{T}, B::QRCompactWYQ{T}) = LAPACK.gemqrt!('R','T',B.factors,B.T.data,A) -A_mul_Bc!{T<:BlasComplex}(A::StridedVecOrMat{T}, B::QRCompactWYQ{T}) = LAPACK.gemqrt!('R','C',B.factors,B.T.data,A) +A_mul_Bc!{T<:BlasReal}(A::StridedVecOrMat{T}, B::QRCompactWYQ{T}) = LAPACK.gemqrt!('R','T',B.factors,B.T,A) +A_mul_Bc!{T<:BlasComplex}(A::StridedVecOrMat{T}, B::QRCompactWYQ{T}) = LAPACK.gemqrt!('R','C',B.factors,B.T,A) A_mul_Bc!{T<:BlasReal}(A::StridedVecOrMat{T}, B::QRPackedQ{T}) = LAPACK.ormqr!('R','T',B.factors,B.τ,A) A_mul_Bc!{T<:BlasComplex}(A::StridedVecOrMat{T}, B::QRPackedQ{T}) = LAPACK.ormqr!('R','C',B.factors,B.τ,A) function A_mul_Bc!{T}(A::AbstractMatrix{T},Q::QRPackedQ{T}) diff --git a/base/linalg/triangular.jl b/base/linalg/triangular.jl index cc5769497ebb18..1448449f634302 100644 --- a/base/linalg/triangular.jl +++ b/base/linalg/triangular.jl @@ -3,6 +3,7 @@ immutable Triangular{T,S<:AbstractMatrix{T},UpLo,IsUnit} <: AbstractMatrix{T} data::S end function Triangular{T}(A::AbstractMatrix{T}, uplo::Symbol, isunit::Bool=false) + chksquare(A) uplo != :L && uplo != :U && throw(ArgumentError("uplo argument must be either :U or :L")) return Triangular{T,typeof(A),uplo,isunit}(A) end diff --git a/test/linalg/triangular.jl b/test/linalg/triangular.jl index e2c7eab040dd97..29495aac8c32ca 100644 --- a/test/linalg/triangular.jl +++ b/test/linalg/triangular.jl @@ -74,4 +74,6 @@ for relty in (Float32, Float64, BigFloat), elty in (relty, Complex{relty}) @test 0.5\M2 == full(0.5\TM2) end end -end \ No newline at end of file +end + +@test_throws DimensionMismatch Triangular(randn(5, 4), :L) From 1e96ba9d81350a4fc4a70c45bd00b88515eaf18b Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 8 Oct 2014 15:15:03 -0400 Subject: [PATCH 24/25] Fix some issues with new Dict constructors - If either the keys or values has the same type for all Pairs, use that type - Deprecations for removed constructors --- base/deprecated.jl | 6 ++++++ base/dict.jl | 18 +++++++++++------- test/collections.jl | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/base/deprecated.jl b/base/deprecated.jl index 1da2517be797dd..4f0514f3c6755c 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -189,3 +189,9 @@ const None = Union() @deprecate median(v::AbstractArray; checknan::Bool=true) median(v) @deprecate median(v::AbstractArray, region; checknan::Bool=true) median(v, region) @deprecate median!(v::AbstractVector; checknan::Bool=true) median!(v) + +@deprecate Dict{K,V}(ks::AbstractArray{K}, vs::AbstractArray{V}) Dict{K,V}(zip(ks, vs)) +@deprecate Dict{K,V}(ks::(K...), vs::(V...)) Dict{K,V}(zip(ks, vs)) +@deprecate Dict{K}(ks::(K...), vs::Tuple) Dict{K,Any}(zip(ks, vs)) +@deprecate Dict{V}(ks::Tuple, vs::(V...)) Dict{Any,V}(zip(ks, vs)) +@deprecate Dict(ks, vs) Dict{Any,Any}(zip(ks, vs)) diff --git a/base/dict.jl b/base/dict.jl index 0a4a319e7fce8d..cf2a39abc52724 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -341,18 +341,22 @@ Dict(kv::()) = Dict() const AnyDict = Dict{Any,Any} # TODO: this can probably be simplified using `eltype` as a THT (Tim Holy trait) -Dict{K,V}(kv::((K,V)...,)) = Dict{K,V}(kv) -Dict{K }(kv::((K,Any)...,)) = Dict{K,Any}(kv) -Dict{V }(kv::((Any,V)...,)) = Dict{Any,V}(kv) -Dict{K,V}(kv::(Pair{K,V}...,)) = Dict{K,V}(kv) -Dict (kv::(Pair...,)) = Dict{Any,Any}(kv) +Dict{K,V}(kv::((K,V)...,)) = Dict{K,V}(kv) +Dict{K }(kv::((K,Any)...,)) = Dict{K,Any}(kv) +Dict{V }(kv::((Any,V)...,)) = Dict{Any,V}(kv) +Dict{K,V}(kv::(Pair{K,V}...,)) = Dict{K,V}(kv) +Dict{K} (kv::(Pair{K}...,)) = Dict{K,Any}(kv) +Dict{V} (kv::(Pair{TypeVar(:K),V}...,)) = Dict{Any,V}(kv) +Dict (kv::(Pair...,)) = Dict{Any,Any}(kv) Dict{K,V}(kv::AbstractArray{(K,V)}) = Dict{K,V}(kv) Dict{K,V}(kv::AbstractArray{Pair{K,V}}) = Dict{K,V}(kv) Dict{K,V}(kv::Associative{K,V}) = Dict{K,V}(kv) -Dict{K,V}(ps::Pair{K,V}...) = Dict{K,V}(ps) -Dict (ps::Pair...) = Dict{Any,Any}(ps) +Dict{K,V}(ps::Pair{K,V}...) = Dict{K,V}(ps) +Dict{K} (ps::Pair{K}...,) = Dict{K,Any}(ps) +Dict{V} (ps::Pair{TypeVar(:K),V}...,) = Dict{Any,V}(ps) +Dict (ps::Pair...) = Dict{Any,Any}(ps) Dict(kv) = dict_with_eltype(kv, eltype(kv)) dict_with_eltype{K,V}(kv, ::Type{(K,V)}) = Dict{K,V}(kv) diff --git a/test/collections.jl b/test/collections.jl index 3543c1430e826b..11a4c6be13c558 100644 --- a/test/collections.jl +++ b/test/collections.jl @@ -57,6 +57,40 @@ end _d = Dict("a"=>0) @test isa([k for k in filter(x->length(x)==1, collect(keys(_d)))], Vector{Any}) +let + d = Dict(((1, 2), (3, 4))) + @test d[1] === 2 + @test d[3] === 4 + d2 = Dict(1 => 2, 3 => 4) + d3 = Dict((1 => 2, 3 => 4)) + @test d == d2 == d3 + @test typeof(d) == typeof(d2) == typeof(d3) == Dict{Int,Int} + + d = Dict(((1, 2), (3, "b"))) + @test d[1] === 2 + @test d[3] == "b" + d2 = Dict(1 => 2, 3 => "b") + d3 = Dict((1 => 2, 3 => "b")) + @test d == d2 == d3 + @test typeof(d) == typeof(d2) == typeof(d3) == Dict{Int,Any} + + d = Dict(((1, 2), ("a", 4))) + @test d[1] === 2 + @test d["a"] === 4 + d2 = Dict(1 => 2, "a" => 4) + d3 = Dict((1 => 2, "a" => 4)) + @test d == d2 == d3 + @test typeof(d) == typeof(d2) == typeof(d3) == Dict{Any,Int} + + d = Dict(((1, 2), ("a", "b"))) + @test d[1] === 2 + @test d["a"] == "b" + d2 = Dict(1 => 2, "a" => "b") + d3 = Dict((1 => 2, "a" => "b")) + @test d == d2 == d3 + @test typeof(d) == typeof(d2) == typeof(d3) == Dict{Any,Any} +end + # issue #1821 let d = Dict{UTF8String, Vector{Int}}() From 032fb9a5da9dc1c17743b9955b0cb8fc0bb4f825 Mon Sep 17 00:00:00 2001 From: Jutho Haegeman Date: Wed, 8 Oct 2014 23:09:37 +0200 Subject: [PATCH 25/25] add test for indexin --- test/arrayops.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/arrayops.jl b/test/arrayops.jl index 0d1116a70239b7..55c40e4e928c85 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -902,3 +902,11 @@ function i7197() ind2sub(size(S), 5) end @test i7197() == (2,2) + +# PR #8622 and general indexin test +function pr8622() + x=[1,3,5,7] + y=[5,4,3] + return indexin(x,y) +end +@test pr8622() == [0,3,1,0]