用法:
normalize(a::AbstractArray, p::Real=2)
規範化數組 a
使其 p
-norm 等於統一,即 norm(a, p) == 1
。另請參見
和 normalize!
。norm
例子
julia> a = [1,2,4];
julia> b = normalize(a)
3-element Vector{Float64}:
0.2182178902359924
0.4364357804719848
0.8728715609439696
julia> norm(b)
1.0
julia> c = normalize(a, 1)
3-element Vector{Float64}:
0.14285714285714285
0.2857142857142857
0.5714285714285714
julia> norm(c, 1)
1.0
julia> a = [1 2 4 ; 1 2 4]
2×3 Matrix{Int64}:
1 2 4
1 2 4
julia> norm(a)
6.48074069840786
julia> normalize(a)
2×3 Matrix{Float64}:
0.154303 0.308607 0.617213
0.154303 0.308607 0.617213
相關用法
- Julia LinearAlgebra.norm用法及代碼示例
- Julia LinearAlgebra.nullspace用法及代碼示例
- Julia LinearAlgebra.BLAS.dot用法及代碼示例
- Julia LinearAlgebra.bunchkaufman用法及代碼示例
- Julia LinearAlgebra.cholesky!用法及代碼示例
- Julia LinearAlgebra.istriu用法及代碼示例
- Julia LinearAlgebra.istril用法及代碼示例
- Julia LinearAlgebra.stride1用法及代碼示例
- Julia LinearAlgebra.svd用法及代碼示例
- Julia LinearAlgebra.logdet用法及代碼示例
- Julia LinearAlgebra.eigen用法及代碼示例
- Julia LinearAlgebra.BLAS.dotu用法及代碼示例
- Julia LinearAlgebra.ldlt!用法及代碼示例
- Julia LinearAlgebra.I用法及代碼示例
- Julia LinearAlgebra.Transpose用法及代碼示例
- Julia LinearAlgebra.det用法及代碼示例
- Julia LinearAlgebra.tril!用法及代碼示例
- Julia LinearAlgebra.schur!用法及代碼示例
- Julia LinearAlgebra.tr用法及代碼示例
- Julia LinearAlgebra.axpby!用法及代碼示例
- Julia LinearAlgebra.adjoint!用法及代碼示例
- Julia LinearAlgebra.eigvecs用法及代碼示例
- Julia LinearAlgebra.LU用法及代碼示例
- Julia LinearAlgebra.isposdef!用法及代碼示例
- Julia LinearAlgebra.LQ用法及代碼示例
注:本文由純淨天空篩選整理自julialang.org 大神的英文原創作品 LinearAlgebra.normalize — Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。