Hello Ján,
On Monday, December 8, 2014 11:04:08 AM UTC+1, Ján Dolinský wrote:
>
>
>> Hi,
>
> Thanks for the explanation. Suppose I have a named array X with 3 columns
> "x1", "x2" and "x3" and I do prod(X, 2). Will the resulting array (a single
> columns in this case) have a sensible name like "x1x2x3" ? Or more
> generally, how are these new names generated and for which operations ?
>
> For some operators NamedArrays tries to generate sensible names, including
prod():
julia> n = NamedArray(rand(2,3), ([:a, :b], [:x1, :x2, :x3]), ("rows",
"cols"))
2x3 NamedArray{Float64,2,Array{Float64,2},(Dict{Symbol,Int64},Dict{Symbol,
Int64})}
rows \ cols x1 x2 x3
a 0.712609 0.607843 0.18794
b 0.208052 0.4409 0.282238
julia> prod(n, 2)
2x1 NamedArray{Float64,2,Array{Float64,2},(Dict{Symbol,Int64},Dict{
ASCIIString,Int64})}
rows \ cols prod(cols)
a 0.0814106
b 0.0258897
So the column in this case is called "prod(cols)". Note that we started
with symbols as names for columns indices in this example but prod()
"normalizes" this to ASCIIStrings.
I've worked hard to make the index type a free choice, but some
automatically generated names default to Strings.
You can find the list of operations for which NamedArrays tries to give
sensible names here
<https://github.com/davidavdav/NamedArrays/blob/master/src/changingnames.jl>,
in the source code. I am open for suggestions and pull requests for more
functions or other names.
As a result of your original question I am now implementing the matrix
operation support more thoroughly, basically following the Julia manual for
possible matrix operations. Some take a bit of effort to implement, for
some I need to think about sensible names for the dimensions. Expect an
update within the next week or so.
Cheers,
---david
Thanks,
> Jan
>