Skip to content

Commit ab4f684

Browse files
committed
Merge pull request #12104 from JuliaLang/anj/rectfull
Move rectuangular full packed matrix support from base to LinearAlgebra.jl
2 parents d4aabee + 1af3420 commit ab4f684

File tree

3 files changed

+0
-239
lines changed

3 files changed

+0
-239
lines changed

base/linalg.jl

-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ include("linalg/symmetric.jl")
224224
include("linalg/diagonal.jl")
225225
include("linalg/bidiag.jl")
226226
include("linalg/uniformscaling.jl")
227-
include("linalg/rectfullpacked.jl")
228227
include("linalg/givens.jl")
229228
include("linalg/special.jl")
230229
include("linalg/bitarray.jl")

base/linalg/lapack.jl

-198
Original file line numberDiff line numberDiff line change
@@ -4085,204 +4085,6 @@ for (trsen, tgsen, elty) in
40854085
end
40864086
end
40874087

4088-
### Rectangular full packed format
4089-
4090-
# Symmetric rank-k operation for matrix in RFP format.
4091-
for (fn, elty, relty) in ((:dsfrk_, :Float64, :Float64),
4092-
(:ssfrk_, :Float32, :Float32),
4093-
(:zhfrk_, :Complex128, :Float64),
4094-
(:chfrk_, :Complex64, :Float32))
4095-
@eval begin
4096-
function sfrk!(transr::Char, uplo::Char, trans::Char, alpha::Real, A::StridedMatrix{$elty}, beta::Real, C::StridedVector{$elty})
4097-
chkuplo(uplo)
4098-
chkstride1(A)
4099-
if trans == 'N' || trans == 'n'
4100-
n, k = size(A)
4101-
elseif trans == 'T' || trans == 't'
4102-
k, n = size(A)
4103-
end
4104-
lda = max(1, stride(A, 2))
4105-
ccall(($(blasfunc(fn)), liblapack), Void,
4106-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt},
4107-
Ptr{BlasInt}, Ptr{$relty}, Ptr{$elty}, Ptr{BlasInt},
4108-
Ptr{$relty}, Ptr{$elty}),
4109-
&transr, &uplo, &trans, &n,
4110-
&k, &alpha, A, &lda,
4111-
&beta, C)
4112-
C
4113-
end
4114-
end
4115-
end
4116-
4117-
# Cholesky factorization of a real symmetric positive definite matrix A
4118-
for (fn, elty) in ((:dpftrf_, :Float64),
4119-
(:spftrf_, :Float32),
4120-
(:zpftrf_, :Complex128),
4121-
(:cpftrf_, :Complex64))
4122-
@eval begin
4123-
function pftrf!(transr::Char, uplo::Char, A::StridedVector{$elty})
4124-
chkuplo(uplo)
4125-
n = round(Int,div(sqrt(8length(A)), 2))
4126-
info = Array(BlasInt, 1)
4127-
ccall(($(blasfunc(fn)), liblapack), Void,
4128-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty},
4129-
Ptr{BlasInt}),
4130-
&transr, &uplo, &n, A,
4131-
info)
4132-
@assertargsok
4133-
@assertnonsingular
4134-
A
4135-
end
4136-
end
4137-
end
4138-
4139-
# Computes the inverse of a (real) symmetric positive definite matrix A using the Cholesky factorization
4140-
for (fn, elty) in ((:dpftri_, :Float64),
4141-
(:spftri_, :Float32),
4142-
(:zpftri_, :Complex128),
4143-
(:cpftri_, :Complex64))
4144-
@eval begin
4145-
function pftri!(transr::Char, uplo::Char, A::StridedVector{$elty})
4146-
chkuplo(uplo)
4147-
n = round(Int,div(sqrt(8length(A)), 2))
4148-
info = Array(BlasInt, 1)
4149-
ccall(($(blasfunc(fn)), liblapack), Void,
4150-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty},
4151-
Ptr{BlasInt}),
4152-
&transr, &uplo, &n, A,
4153-
info)
4154-
@assertargsok
4155-
@assertnonsingular
4156-
A
4157-
end
4158-
end
4159-
end
4160-
4161-
# DPFTRS solves a system of linear equations A*X = B with a symmetric positive definite matrix A using the Cholesky factorization
4162-
for (fn, elty) in ((:dpftrs_, :Float64),
4163-
(:spftrs_, :Float32),
4164-
(:zpftrs_, :Complex128),
4165-
(:cpftrs_, :Complex64))
4166-
@eval begin
4167-
function pftrs!(transr::Char, uplo::Char, A::StridedVector{$elty}, B::StridedVecOrMat{$elty})
4168-
chkuplo(uplo)
4169-
chkstride1(B)
4170-
n = round(Int,div(sqrt(8length(A)), 2))
4171-
if n != size(B, 1)
4172-
throw(DimensionMismatch("B has first dimension $(size(B,1)) but needs $n"))
4173-
end
4174-
nhrs = size(B, 2)
4175-
ldb = max(1, stride(B, 2))
4176-
info = Array(BlasInt, 1)
4177-
ccall(($(blasfunc(fn)), liblapack), Void,
4178-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
4179-
Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}),
4180-
&transr, &uplo, &n, &nhrs,
4181-
A, B, &ldb, info)
4182-
@assertargsok
4183-
@assertposdef
4184-
B
4185-
end
4186-
end
4187-
end
4188-
4189-
# Solves a matrix equation (one operand is a triangular matrix in RFP format)
4190-
for (fn, elty) in ((:dtfsm_, :Float64),
4191-
(:stfsm_, :Float32),
4192-
(:ztfsm_, :Complex128),
4193-
(:ctfsm_, :Complex64))
4194-
@eval begin
4195-
function pftrs!(transr::Char, side::Char, uplo::Char, trans::Char, diag::Char, alpha::Real, A::StridedVector{$elty}, B::StridedMatrix{$elty})
4196-
chkuplo(uplo)
4197-
chkside(side)
4198-
chkdiag(diag)
4199-
chkstride1(B)
4200-
m, n = size(B)
4201-
if round(Int, div(sqrt(8length(A)), 2)) != m
4202-
throw(DimensionMismatch("First dimension of B must equal $(round(Int, div(sqrt(8length(A)), 2))), got $m"))
4203-
end
4204-
ldb = max(1, stride(B, 2))
4205-
ccall(($(blasfunc(fn)), liblapack), Void,
4206-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8},
4207-
Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty},
4208-
Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}),
4209-
&transr, &side, &uplo, &trans,
4210-
&diag, &m, &n, &alpha,
4211-
A, B, &ldb)
4212-
B
4213-
end
4214-
end
4215-
end
4216-
4217-
# Computes the inverse of a triangular matrix A stored in RFP format.
4218-
for (fn, elty) in ((:dtftri_, :Float64),
4219-
(:stftri_, :Float32),
4220-
(:ztftri_, :Complex128),
4221-
(:ctftri_, :Complex64))
4222-
@eval begin
4223-
function tftri!(transr::Char, uplo::Char, diag::Char, A::StridedVector{$elty})
4224-
chkuplo(uplo)
4225-
chkdiag(diag)
4226-
n = round(Int,div(sqrt(8length(A)), 2))
4227-
info = Array(BlasInt, 1)
4228-
ccall(($(blasfunc(fn)), liblapack), Void,
4229-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt},
4230-
Ptr{$elty}, Ptr{BlasInt}),
4231-
&transr, &uplo, &diag, &n,
4232-
A, info)
4233-
@assertargsok
4234-
@assertnonsingular
4235-
A
4236-
end
4237-
end
4238-
end
4239-
4240-
# Copies a triangular matrix from the rectangular full packed format (TF) to the standard full format (TR)
4241-
for (fn, elty) in ((:dtfttr_, :Float64),
4242-
(:stfttr_, :Float32),
4243-
(:ztfttr_, :Complex128),
4244-
(:ctfttr_, :Complex64))
4245-
@eval begin
4246-
function tfttr!(transr::Char, uplo::Char, Arf::StridedVector{$elty})
4247-
chkuplo(uplo)
4248-
n = round(Int,div(sqrt(8length(Arf)), 2))
4249-
info = Array(BlasInt, 1)
4250-
A = similar(Arf, $elty, n, n)
4251-
ccall(($(blasfunc(fn)), liblapack), Void,
4252-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty},
4253-
Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}),
4254-
&transr, &uplo, &n, Arf,
4255-
A, &n, info)
4256-
@assertargsok
4257-
A
4258-
end
4259-
end
4260-
end
4261-
4262-
# Copies a triangular matrix from the standard full format (TR) to the rectangular full packed format (TF).
4263-
for (fn, elty) in ((:dtrttf_, :Float64),
4264-
(:strttf_, :Float32),
4265-
(:ztrttf_, :Complex128),
4266-
(:ctrttf_, :Complex64))
4267-
@eval begin
4268-
function trttf!(transr::Char, uplo::Char, A::StridedMatrix{$elty})
4269-
chkuplo(uplo)
4270-
chkstride1(A)
4271-
n = size(A, 1)
4272-
lda = max(1, stride(A, 2))
4273-
info = Array(BlasInt, 1)
4274-
Arf = similar(A, $elty, div(n*(n+1), 2))
4275-
ccall(($(blasfunc(fn)), liblapack), Void,
4276-
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty},
4277-
Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt}),
4278-
&transr, &uplo, &n, A,
4279-
&lda, Arf, info)
4280-
@assertargsok
4281-
Arf
4282-
end
4283-
end
4284-
end
4285-
42864088
# Solves the real Sylvester matrix equation: op(A)*X +- X*op(B) = scale*C and A and B are both upper quasi triangular.
42874089
for (fn, elty, relty) in ((:dtrsyl_, :Float64, :Float64),
42884090
(:strsyl_, :Float32, :Float32),

base/linalg/rectfullpacked.jl

-40
This file was deleted.

0 commit comments

Comments
 (0)