@@ -4,26 +4,40 @@ import LinearAlgebra.BLAS: nrm2, blascopy!, axpy!, axpby!, scal!
44
55export dot, nrm2, blascopy!, axpy!, axpby!, scal!, copyaxpy!
66
7- nrm2 (n :: Int , x :: Vector{T} ) where T <: BLAS.BlasReal = BLAS. nrm2 (n, x, 1 )
8- nrm2 (n :: Int , x :: AbstractVector{T} ) where T <: Number = norm (x)
9-
10- dot (n :: Int , x :: Vector{T} , y :: Vector{T} ) where T <: BLAS.BlasReal = BLAS. dot (n, x, 1 , y, 1 )
11- dot (n :: Int , x :: AbstractVector{T} , y :: AbstractVector{T} ) where T <: Number = dot (x, y)
12-
13- axpy! (n :: Int , t :: T , d :: Vector{T} , x :: Vector{T} ) where T <: BLAS.BlasReal = BLAS. axpy! (n, t, d, 1 , x, 1 )
14- axpy! (n :: Int , t :: T , d :: AbstractVector{T} , x :: AbstractVector{T} ) where T <: Number = (x .+ = t .* d)
15-
16- axpby! (n :: Int , t :: T , d :: Vector{T} , s :: T , x :: Vector{T} ) where T <: BLAS.BlasReal = BLAS. axpby! (n, t, d, 1 , s, x, 1 )
17- axpby! (n :: Int , t :: T , d :: AbstractVector{T} , s :: T , x :: AbstractVector{T} ) where T <: Number = (x .= t .* d .+ s .* x)
18-
19- scal! (n :: Int , t :: T , x :: Vector{T} ) where T <: BLAS.BlasReal = BLAS. scal! (n, t, x, 1 )
20- scal! (n :: Int , t :: T , x :: AbstractVector{T} ) where T <: Number = (x .*= t)
21-
22- function copyaxpy! (n :: Int , t :: T , d :: Vector{T} , x :: Vector{T} , xt :: Vector{T} ) where T <: BLAS.BlasReal
7+ nrm2 (n:: Int , x:: Vector{T} ) where {T <: BLAS.BlasReal } = BLAS. nrm2 (n, x, 1 )
8+ nrm2 (n:: Int , x:: AbstractVector{T} ) where {T <: Number } = norm (x)
9+
10+ dot (n:: Int , x:: Vector{T} , y:: Vector{T} ) where {T <: BLAS.BlasReal } = BLAS. dot (n, x, 1 , y, 1 )
11+ dot (n:: Int , x:: AbstractVector{T} , y:: AbstractVector{T} ) where {T <: Number } = dot (x, y)
12+
13+ axpy! (n:: Int , t:: T , d:: Vector{T} , x:: Vector{T} ) where {T <: BLAS.BlasReal } =
14+ BLAS. axpy! (n, t, d, 1 , x, 1 )
15+ axpy! (n:: Int , t:: T , d:: AbstractVector{T} , x:: AbstractVector{T} ) where {T <: Number } = (x .+ = t .* d)
16+
17+ axpby! (n:: Int , t:: T , d:: Vector{T} , s:: T , x:: Vector{T} ) where {T <: BLAS.BlasReal } =
18+ BLAS. axpby! (n, t, d, 1 , s, x, 1 )
19+ axpby! (n:: Int , t:: T , d:: AbstractVector{T} , s:: T , x:: AbstractVector{T} ) where {T <: Number } =
20+ (x .= t .* d .+ s .* x)
21+
22+ scal! (n:: Int , t:: T , x:: Vector{T} ) where {T <: BLAS.BlasReal } = BLAS. scal! (n, t, x, 1 )
23+ scal! (n:: Int , t:: T , x:: AbstractVector{T} ) where {T <: Number } = (x .*= t)
24+
25+ function copyaxpy! (
26+ n:: Int ,
27+ t:: T ,
28+ d:: Vector{T} ,
29+ x:: Vector{T} ,
30+ xt:: Vector{T} ,
31+ ) where {T <: BLAS.BlasReal }
2332 BLAS. blascopy! (n, x, 1 , xt, 1 )
2433 BLAS. axpy! (n, t, d, 1 , xt, 1 )
2534end
26- function copyaxpy! (n :: Int , t :: T , d :: AbstractVector{T} , x :: AbstractVector{T} , xt :: AbstractVector{T} ) where T <: Number
35+ function copyaxpy! (
36+ n:: Int ,
37+ t:: T ,
38+ d:: AbstractVector{T} ,
39+ x:: AbstractVector{T} ,
40+ xt:: AbstractVector{T} ,
41+ ) where {T <: Number }
2742 xt .= x .+ t .* d
2843end
29-
0 commit comments