Just to put in context. If I read using DelimitedFiles
the data from a file with a single column of data, with, for example,
x = readdlm("./data.txt")
x
is returned as an Array{Float64,2}
with sizes (n,1)
. If I try directly to use this array in some LinearAlgebra
function, I get an error, which is described by a minimal working example below.
My question is: should this be filled as a bug somewhere? That DelimitedFiles
returns an array with dimension 2 is a bug, or LinearAlgebra
functions should be able to deal with that pecularity? Or, more globally, is there any reason for the existence of “multidimensional arrays” which are not really multidimensional?
The issue:
julia> using LinearAlgebra
julia> a = ones(2) ; c = zeros(1);
julia> b = ones(2);
julia> mul!(c,transpose(a),b)
1-element Array{Float64,1}:
2.0
julia> b = ones(2,1)
2Ă—1 Array{Float64,2}:
1.0
1.0
julia> mul!(c,transpose(a),b)
ERROR: MethodError: no method matching mul!(::Array{Float64,1}, ::Transpose{Float64,Array{Float64,1}}, ::Array{Float64,2}, ::Bool, ::Bool)