我正在尝试用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
转载请注明出处:http://www.jubohx.com/article/20230525/958478.html