Skip to content

Commit

Permalink
Implement StridedArray interface
Browse files Browse the repository at this point in the history
for compatibility with BLAS/LAPACK operations
  • Loading branch information
Omar-Elrefaei committed Feb 24, 2023
1 parent b871f24 commit 9676789
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/QuasiTriangular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import Base.getindex
import Base.require_one_based_indexing
import Base.setindex!
import Base.copy
import Base.Matrix
import Base.strides
import Base.elsize
import Base.unsafe_convert
import LinearAlgebra.checksquare
import LinearAlgebra.BlasInt
import LinearAlgebra.BLAS.@blasfunc
Expand Down Expand Up @@ -72,6 +76,11 @@ function setindex!(A::QuasiUpperTriangular, x, i::Integer, j::Integer)
return A
end

## Implement StridedArray interface to be compatible with generic BLAS calls
Base.strides(a::QuasiUpperTriangular{T, <: AbstractMatrix{T}}) where {T} = strides(a.data)
Base.elsize(::Type{<:QuasiUpperTriangular{T, <: AbstractMatrix{T}}}) where T = Base.elsize(Matrix{T})
Base.unsafe_convert(::Type{Ptr{T}}, a::QuasiUpperTriangular{T, <: AbstractMatrix{T}}) where {T} = pointer(a.data)

## Generic quasi triangular right vector, multiplication
function A_mul_B!(a::QuasiUpperTriangular,b::AbstractVector,work::AbstractVector)
if size(a,1) < 27
Expand Down

0 comments on commit 9676789

Please sign in to comment.