Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function readMatrix( matrixAFile::AbstractString; vectorBFile=nothing)
- open(matrixAFile, "r") do f
- line = strip(readline(f), ['\n', '\t'])
- line = split(line, " ")
- n = parse(Int, line[1])
- l = parse(Int, line[2])
- I = Int64[]
- J = Int64[]
- V = Float64[]
- index = 1
- while !eof(f)
- line = strip(readline(f), ['\n'])
- line = split(line, " ")
- push!(I, parse(Int64, line[1]))
- push!(J, parse(Int64, line[2]))
- push!(V, parse(Float64, line[3]))
- index = index + 1
- end
- println(V)
- S = sparse(I,J,V)
- println(S)
- end #open
- end #readMatrix
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement