【发布时间】:2019-01-11 02:07:25
【问题描述】:
我正在尝试将 Julia 用于一些线性代数。该文档列出了许多适合使用矩阵的函数。其中一些直接用于运行 Julia,例如
julia> ones(2,2)
2×2 Array{Float64,2}:
1.0 1.0
1.0 1.0
而其他人则提供UndefVarError,例如
julia> eye(2,2)
ERROR: UndefVarError: eye not defined
Stacktrace:
[1] top-level scope at none:0
为什么我只能访问线性代数部分列出的部分函数? https://michaelhatherly.github.io/julia-docs/en/latest/stdlib/linalg.html#Base.LinAlg.expm
我也尝试过导入 LinearAlgebra 包,但这并没有什么不同:
julia> using LinearAlgebra
julia> eye(2,2)
ERROR: UndefVarError: eye not defined
Stacktrace:
[1] top-level scope at none:0
事实上,一些功能现在变得可用,例如dot,而根据文档也属于线性代数库的其他人继续给出错误:
julia> dot
ERROR: UndefVarError: dot not defined
julia> using LinearAlgebra
julia> dot
dot (generic function with 12 methods)
julia> vecdot
ERROR: UndefVarError: vecdot not defined
以上两个函数在文档中都列为Base.LinAlg.dot。
我目前安装的包有:
(v1.0) pkg> status
Status `~/.julia/environments/v1.0/Project.toml`
[0c46a032] DifferentialEquations v5.3.1
[7073ff75] IJulia v1.13.0
[91a5bcdd] Plots v0.21.0
[37e2e46d] LinearAlgebra
[2f01184e] SparseArrays
线性代数页面上讨论的许多其他函数都会出现此问题:
julia> repmat([1, 2, 3], 2)
ERROR: UndefVarError: repmat not defined
Stacktrace:
[1] top-level scope at none:0
我安装了 Julia vs1.01
【问题讨论】:
-
eye现在是LinearAlgebra.I。
标签: julia