當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Julia LinearAlgebra.UniformScaling方法用法及代碼示例


用法:

(I::UniformScaling)(n::Integer)

UniformScaling 構造 Diagonal 矩陣。

Julia 1.2

此方法從 Julia 1.2 開始可用。

例子

julia> I(3)
3×3 Diagonal{Bool, Vector{Bool}}:
 1  ⋅  ⋅
 ⋅  1  ⋅
 ⋅  ⋅  1

julia> (0.7*I)(3)
3×3 Diagonal{Float64, Vector{Float64}}:
 0.7   ⋅    ⋅
  ⋅   0.7   ⋅
  ⋅    ⋅   0.7

相關用法


注:本文由純淨天空篩選整理自julialang.org 大神的英文原創作品 LinearAlgebra.UniformScaling — Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。