I have a linear equation AA*z = bb where AA is a full rank, sparse matrix :
julia> AA
650×650 SparseMatrixCSC{Float64, Int64} with 2280 stored entries:
...
When I try to solve the equation, I get an error message:
julia> AA \ bb
MethodError: no method matching lu!(::SparseMatrixCSC{Float64, Int64}, ::RowMaximum; check=true)
Closest candidates are:
lu!(::StridedMatrix{T...
NOTE: Matrix(AA) \ bb works without a hitch, but that will kill the advantage of introducing a sparse matrix, I guess…
I then tried to download LinearSolve.jl (presented in JuliaCon 2022).
julia> Pkg.add("LinearSolve")
Resolving package versions...
Output exceeds the size limit. Open the full output data in a text editor
Unable to automatically download/install artifact 'Qt5Base' from sources listed in 'C:\Users\User_name\.julia\packages\Qt5Base_jll\RCHuc\Artifacts.toml'.
Sources attempted:
- https://pkg.julialang.org/artifact/14c036187f02f2def7e45b19b27ea5d4a5873e21
Error: IOError: could not spawn setenv(`7z.exe ...
Arrgh. I found the problem… In my case, bb is a sparse 650\times 1 matrix. Seems like I need to convert it to a dense vector first. So for my data, the following works:
z = AA \ Matrix(bb)[:]
Is there a better way to do this? Perhaps I should just let bb be dense all the way, since that doesn’t really waste a lot of storage space?
in general you probably shouldn’t be using Nx1 matrices in general. They tends to come from matlabisms like rand(n,1) instead of rand(n). making sure your types match the algebra you expect will save you time in the long run.
NOTE 1: there is a reference to “downloaded artifact: Qt5Base”.
NOTE 2: in my previous attempt, I tried to download LinearSolve in VSCode after I had added a few other packages.
You are right – it was not a clean environment. Still, LinearSolve now works in my “global” environment.
= =
Yeah, I started looking into Pkg.jl with the idea of beginning to use the environment facility. What stopped me was the following:
I didn’t find info on how to specify the valid Julia version in the environment. In other words: I understand how I can specify the versions of various packages in a new environment, but not how I can also specify which version of Julia to use. Maybe I didn’t read the documentation properly…
The idea of specifying the Julia version for a certain environment is important, I think… When I upgraded Julia from v. 1.6.2 to 1.6.3 (if I’m right), package Turing stopped working, and it took weeks before it worked again.
Thus, if I had created an environment with specified versions of certain packages and the environment did not contain information of which Julia version to use, I would either have to remember which Julia version I could use with the environment [error prone…], or I would have to stop upgrading Julia.
OK – it is possible the environment holds information about which Julia version to use – e.g., the Julia version I specify when I create the environment, but I didn’t see information about that in the documentation. [I checked it out perhaps 6 months ago. I haven’t checked the documentation for updates.]