Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JuliaLang/julia
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Mar 1, 2014
2 parents b706399 + 92e2ab1 commit 646d3d4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
8 changes: 5 additions & 3 deletions base/linalg/factorization.jl
Expand Up @@ -568,14 +568,16 @@ end
A_ldiv_B!(A::QR, B::StridedVector) = A_ldiv_B!(A, reshape(B, length(B), 1))[:]
A_ldiv_B!(A::QRPivoted, B::StridedVector) = A_ldiv_B!(QR(A.factors,A.τ),B)[invperm(A.jpvt)]
A_ldiv_B!(A::QRPivoted, B::StridedMatrix) = A_ldiv_B!(QR(A.factors,A.τ),B)[invperm(A.jpvt),:]
function \{TA,TB}(A::Union(QR{TA},QRCompactWY{TA},QRPivoted{TA}),B::StridedVector{TB})
S = promote_type(TA,TB)
function \{TA,Tb}(A::Union(QR{TA},QRCompactWY{TA},QRPivoted{TA}),b::StridedVector{Tb})
S = promote_type(TA,Tb)
m,n = size(A)
n > m ? A_ldiv_B!(convert(typeof(A).name.primary{S},A),[B,zeros(S,n-m)]) : A_ldiv_B!(convert(typeof(A).name.primary{S},A), S == TB ? copy(B) : convert(Vector{S}, B))
m == length(b) || throw(DimensionMismatch("left hand side has $(m) rows, but right hand side has length $(length(b))"))
n > m ? A_ldiv_B!(convert(typeof(A).name.primary{S},A),[b,zeros(S,n-m)]) : A_ldiv_B!(convert(typeof(A).name.primary{S},A), S == Tb ? copy(b) : convert(Vector{S}, b))
end
function \{TA,TB}(A::Union(QR{TA},QRCompactWY{TA},QRPivoted{TA}),B::StridedMatrix{TB})
S = promote_type(TA,TB)
m,n = size(A)
m == size(B,1) || throw(DimensionMismatch("left hand side has $(m) rows, but right hand side has $(size(B,1)) rows"))
n > m ? A_ldiv_B!(convert(typeof(A).name.primary{S},A),[B;zeros(S,n-m,size(B,2))]) : A_ldiv_B!(convert(typeof(A).name.primary{S},A), S == TB ? copy(B) : convert(Matrix{S}, B))
end

Expand Down
3 changes: 2 additions & 1 deletion base/linalg/matmul.jl
Expand Up @@ -167,7 +167,8 @@ function gemv{T<:BlasFloat}(y::StridedVector{T}, tA::Char, A::StridedMatrix{T},
(mA, nA) = size(A)
end

nA==length(x) || mA==length(y) || throw(DimensionMismatch("*"))
nA==length(x) || throw(DimensionMismatch(""))
mA==length(y) || throw(DimensionMismatch(""))
mA == 0 && return zeros(T, 0)
nA == 0 && return zeros(T, mA)
return BLAS.gemv!(tA, one(T), A, x, zero(T), y)
Expand Down
14 changes: 8 additions & 6 deletions deps/jldownload
Expand Up @@ -5,9 +5,9 @@

MIRROR_HOST=http://d304tytmzqn1fl.cloudfront.net

WGET=$(which wget)
CURL=$(which curl)
FETCH=$(which fetch)
WGET=$(which wget 2>/dev/null)
CURL=$(which curl 2>/dev/null)
FETCH=$(which fetch 2>/dev/null)

TIMEOUT=15 # seconds
WGET_OPTS="--no-check-certificate --tries=1 --timeout=$TIMEOUT"
Expand All @@ -29,13 +29,15 @@ fi
MIRROR_BASENAME=`basename $1`
MIRROR_URL="$MIRROR_HOST/$MIRROR_BASENAME"

if [ -x $CURL ] && $CURL -V >/dev/null; then
if [ -x "$CURL" ] && $CURL -V >/dev/null; then
GETURL="$CURL $CURL_OPTS"
elif [ -x $WGET ] && $WGET -V >/dev/null; then
elif [ -x "$WGET" ] && $WGET -V >/dev/null; then
GETURL="$WGET $WGET_OPTS"
elif [ -x $FETCH ]; then
elif [ -x "$FETCH" ]; then
GETURL="$FETCH $FETCH_OPTS"
else
echo "Could not find working curl, wget, or fetch."
echo "You need to install one of these to download dependencies."
exit 1
fi

Expand Down
2 changes: 2 additions & 0 deletions test/linalg1.jl
Expand Up @@ -190,6 +190,8 @@ debug && println("Generalized svd")
debug && println("Solve square general system of equations")
x = a \ b
@test_approx_eq_eps a*x b 80ε
@test_throws b'\b
@test_throws b\b'

debug && println("Solve upper triangular system")
x = triu(a) \ b
Expand Down

0 comments on commit 646d3d4

Please sign in to comment.