Skip to content

Commit a1f72e2

Browse files
committed
Add missing chkstride1 to LAPACK wrappers
1 parent 694b9f8 commit a1f72e2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

base/linalg/lapack.jl

+12-3
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt3, gerqf, getrf, elty, relty) in
260260
A, tau, jpvt
261261
end
262262
function geqrt3!(A::StridedMatrix{$elty})
263+
chkstride1(A)
263264
m, n = size(A)
264265
lda = max(1, stride(A, 2))
265266
T = Array($elty, n, n)
@@ -466,7 +467,7 @@ for (gelsd, elty) in ((:dgelsd_, :Float64),
466467
# INTEGER IWORK( * )
467468
# DOUBLE PRECISION A( LDA, * ), B( LDB, * ), S( * ), WORK( * )
468469
function gelsd!(A::StridedMatrix{$elty}, B::StridedVecOrMat{$elty}, rcond)
469-
LAPACK.chkstride1(A, B)
470+
chkstride1(A, B)
470471
m, n = size(A)
471472
if size(B, 1) != m; throw(DimensionMismatch("gelsd!")); end
472473
if size(B, 1) < n
@@ -515,7 +516,7 @@ for (gelsd, elty, relty) in ((:zgelsd_, :Complex128, :Float64),
515516
# DOUBLE PRECISION RWORK( * ), S( * )
516517
# COMPLEX*16 A( LDA, * ), B( LDB, * ), WORK( * )
517518
function gelsd!(A::StridedMatrix{$elty}, B::StridedVecOrMat{$elty}, rcond)
518-
LAPACK.chkstride1(A, B)
519+
chkstride1(A, B)
519520
m, n = size(A)
520521
if size(B,1) != m; throw(DimensionMismatch("gelsd!")); end
521522
if size(B, 1) < n
@@ -783,6 +784,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in
783784
# COMPLEX*16 A( LDA, * ), B( LDB, * ), Q( LDQ, * ),
784785
# $ U( LDU, * ), V( LDV, * ), WORK( * )
785786
function ggsvd!(jobu::BlasChar, jobv::BlasChar, jobq::BlasChar, A::Matrix{$elty}, B::Matrix{$elty})
787+
chkstride1(A, B)
786788
m, n = size(A)
787789
if size(B, 2) != n; throw(DimensionMismatch); end
788790
p = size(B, 1)
@@ -1045,6 +1047,7 @@ for (orglq, orgqr, ormlq, ormqr, gemqrt, elty) in
10451047
C
10461048
end
10471049
function gemqrt!(side::Char, trans::Char, V::Matrix{$elty}, T::Matrix{$elty}, C::StridedVecOrMat{$elty})
1050+
chkstride1(T, C)
10481051
m = size(C, 1)
10491052
n = size(C, 2)
10501053
k = size(T, 1)
@@ -1703,7 +1706,7 @@ for (bdsqr, relty, elty) in
17031706
#*> zero-shift QR algorithm.
17041707
function bdsqr!(uplo::BlasChar, d::Vector{$relty}, e_::Vector{$relty},
17051708
vt::StridedMatrix{$elty}, u::StridedMatrix{$elty}, c::StridedMatrix{$elty})
1706-
1709+
17071710
validate(uplo)
17081711
n = length(d)
17091712
if length(e_) != n-1 throw(DimensionMismatch("bdsqr!")) end
@@ -2129,6 +2132,7 @@ for (gees, gges, elty) in
21292132
# DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
21302133
# $ B( LDB, * ), BETA( * ), VSL( LDVSL, * ),
21312134
# $ VSR( LDVSR, * ), WORK( * )
2135+
chkstride1(A, B)
21322136
n = size(A, 1)
21332137
if size(A, 2) != n || size(B, 1) != size(B, 2) throw(DimensionMismatch("Matrices must be square")) end
21342138
if size(B, 1) != n throw(DimensionMismatch("Matrices are not of same size")) end
@@ -2221,6 +2225,7 @@ for (gees, gges, elty, relty) in
22212225
# COMPLEX*16 A( LDA, * ), ALPHA( * ), B( LDB, * ),
22222226
# $ BETA( * ), VSL( LDVSL, * ), VSR( LDVSR, * ),
22232227
# $ WORK( * )
2228+
chkstride1(A, B)
22242229
n = size(A, 1)
22252230
if size(A, 2) != n || size(B, 1) != size(B, 2) throw(DimensionMismatch("Matrices must be square")) end
22262231
if size(B, 1) != n throw(DimensionMismatch("Matrices are not of same size")) end
@@ -2269,6 +2274,7 @@ for (fn, elty, relty) in ((:dsfrk_, :Float64, :Float64),
22692274
(:chfrk_, :Complex64, :Float32))
22702275
@eval begin
22712276
function sfrk!(transr::Char, uplo::Char, trans::Char, alpha::Real, A::StridedMatrix{$elty}, beta::Real, C::StridedVector{$elty})
2277+
chkstride1(A)
22722278
if trans == 'N'
22732279
n, k = size(A)
22742280
elseif trans == 'T'
@@ -2336,6 +2342,7 @@ for (fn, elty) in ((:dpftrs_, :Float64),
23362342
(:cpftrs_, :Complex64))
23372343
@eval begin
23382344
function pftrs!(transr::Char, uplo::Char, A::StridedVector{$elty}, B::StridedVecOrMat{$elty})
2345+
chkstride1(B)
23392346
n = int(div(sqrt(8length(A)), 2))
23402347
if n != size(B, 1) throw(DimensionMismatch("A and B must have the same number of rows")) end
23412348
nhrs = size(B, 2)
@@ -2359,6 +2366,7 @@ for (fn, elty) in ((:dtfsm_, :Float64),
23592366
(:ctfsm_, :Complex64))
23602367
@eval begin
23612368
function pftrs!(transr::Char, side::Char, uplo::Char, trans::Char, diag::Char, alpha::Real, A::StridedVector{$elty}, B::StridedMatrix{$elty})
2369+
chkstride1(B)
23622370
m, n = size(B)
23632371
if int(div(sqrt(8length(A)), 2)) != m throw(DimensionMismatch("")) end
23642372
ldb = max(1, stride(B, 2))
@@ -2422,6 +2430,7 @@ for (fn, elty) in ((:dtrttf_, :Float64),
24222430
(:ctrttf_, :Complex64))
24232431
@eval begin
24242432
function trttf!(transr::Char, uplo::Char, A::StridedMatrix{$elty})
2433+
chkstride1(A)
24252434
n = size(A, 1)
24262435
lda = max(1, stride(A, 2))
24272436
info = Array(BlasInt, 1)

0 commit comments

Comments
 (0)