Skip to content

Commit 7fd30fb

Browse files
committed
fscale
1 parent 11e54cf commit 7fd30fb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/_util_center_scale.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
fcenter(X, v)
3-
fcenter!(X::Matrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
3+
fcenter!(X::AbstractMatrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
44
Center each column of a matrix.
55
* `X` : Data (n, p).
66
* `v` : Centering vector (p).
@@ -21,15 +21,15 @@ function fcenter(X, v)
2121
zX
2222
end
2323

24-
function fcenter!(X::Matrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
24+
function fcenter!(X::AbstractMatrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
2525
@inbounds for j in axes(X, 2), i in axes(X, 1)
2626
X[i, j] -= v[j]
2727
end
2828
end
2929

3030
"""
3131
fscale(X, v)
32-
fscale!(X::Matrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
32+
fscale!(X::AbstractMatrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
3333
Scale each column of a matrix.
3434
* `X` : Data (n, p).
3535
* `v` : Scaling vector (p).
@@ -48,15 +48,15 @@ function fscale(X, v)
4848
zX
4949
end
5050

51-
function fscale!(X::Matrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
51+
function fscale!(X::AbstractMatrix{Q}, v::Vector{Q}) where Q <: AbstractFloat
5252
@inbounds for j in axes(X, 2), i in axes(X, 1)
5353
X[i, j] /= v[j]
5454
end
5555
end
5656

5757
"""
5858
fcscale(X, u, v)
59-
fcscale!(X::Matrix{Q}, u::Vector{Q}, v::Vector{Q}) where Q <: AbstractFloat
59+
fcscale!(X::AbstractMatrix{Q}, u::Vector{Q}, v::Vector{Q}) where Q <: AbstractFloat
6060
Center and scale each column of a matrix.
6161
* `X` : Data (n, p).
6262
* `u` : Centering vector (p).
@@ -79,7 +79,7 @@ function fcscale(X, u, v)
7979
zX
8080
end
8181

82-
function fcscale!(X::Matrix{Q}, u::Vector{Q}, v::Vector{Q}) where Q <: AbstractFloat
82+
function fcscale!(X::AbstractMatrix{Q}, u::Vector{Q}, v::Vector{Q}) where Q <: AbstractFloat
8383
@inbounds for j in axes(X, 2), i in axes(X, 1)
8484
X[i, j] = (X[i, j] - u[j]) / v[j]
8585
end

0 commit comments

Comments
 (0)