Commit c92356ac authored by Éric Thiébaut's avatar Éric Thiébaut
Browse files

Add file_prefix and extend LinearAlgebra.lmul!

parent 2b5f911a
......@@ -46,9 +46,7 @@ uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
[[EasyFITS]]
deps = ["CFITSIO", "FITSIO"]
git-tree-sha1 = "576f3332f49a167889b78ce280bd2882c94d1e2d"
repo-rev = "master"
repo-url = "https://github.com/emmt/EasyFITS.jl"
path = "../../EasyFITS.jl"
uuid = "a977f4a2-36a7-4172-89e7-19c2726f82e5"
version = "0.2.1"
......@@ -161,9 +159,9 @@ uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
[[TableTraits]]
deps = ["IteratorInterfaceExtensions"]
git-tree-sha1 = "b1ad568ba658d8cbb3b892ed5380a6f3e781a81e"
git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39"
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.0"
version = "1.0.1"
[[Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"]
......
......@@ -5,7 +5,9 @@ version = "0.1.0"
[deps]
ArrayTools = "1dc0ca97-c5ce-4e77-ac6d-c576ac9d7f27"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
EasyFITS = "a977f4a2-36a7-4172-89e7-19c2726f82e5"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MayOptimize = "049513e6-5a5e-4281-9d48-334ebac8954e"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
......
......@@ -32,6 +32,7 @@ const xpaget = XPA.get
const xpaset = XPA.set
using MayOptimize
using LinearAlgebra
import Base: reset
import Sockets: send
......
......@@ -84,6 +84,22 @@ of `A` are already of the requested type, `A` is returned, not a copy.
of_eltype(::Type{T}, A::AbstractArray{T}) where {T} = A
of_eltype(::Type{T}, A::AbstractArray) where {T} = copyto!(similar(A, T), A)
#------------------------------------------------------------------------------
# DATE
import Dates
"""
file_prefix(dt = Dates.now(Dates.UTC))
yields the prefix used for TAO data files and based on the UTC date `dt`.
The result is a string of the form: `"YYYYmmdd/YYYYmmdd-HHMMSS-"`
or just `"YYYYmmdd-HHMMSS-"` if keyword `basename` is true.
"""
file_prefix(dt::Dates.DateTime = Dates.now(Dates.UTC); basename::Bool=false) =
Dates.format(dt, (basename ? "YYYYmmdd-HHMMSS-" :
"YYYYmmdd/YYYYmmdd-HHMMSS-"))
#------------------------------------------------------------------------------
# LAYOUT
......@@ -246,3 +262,30 @@ function scale!(Opt::Type{<:OptimLevel},
end
return A
end
# The following is a replacement of lmul! that may be faster than the BLAS
# version for small arrays, smaller than say 100×100. FIXME: should be part of
# MayOptimize.
function LinearAlgebra.lmul!(opt::Type{<:OptimLevel},
A::LowerTriangular{T},
b::AbstractVector{T}) where {T<:AbstractFloat}
I, J = axes(A)
@assert I == J
@assert Base.axes1(b) == J
@maybe_inbounds opt for i in reverse(I)
s = zero(T)
@maybe_vectorized P for j in J
s += A[i,j]*b[j]
end
b[i] = s
end
return b
end
# Manage to call Julia version (probably BLAS).
function LinearAlgebra.lmul!(::Type{<:MayOptimize.Standard},
A::LowerTriangular{T},
b::AbstractVector{T}) where {T<:AbstractFloat}
lmul!(A, b)
return b
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment