Discussion:
[Pdl-porters] Hash like keys ?
mraptor
2014-12-11 22:08:59 UTC
Permalink
Is there a way to use hash-like keys for the rows ?
I mean w/o using external hash-to-idx map..


-------| http://ifni.co
Chris Marshall
2014-12-11 22:57:03 UTC
Permalink
Take a look at PDL::Dims.
Post by mraptor
Is there a way to use hash-like keys for the rows ?
I mean w/o using external hash-to-idx map..
-------| http://ifni.co
_______________________________________________
PDL-porters mailing list
http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
Ingo Schmid
2014-12-12 11:15:16 UTC
Permalink
thanks Chris for mentioning it. I just uploaded a new version. I'd
appreciate any feedback on usability, features, etc.

Ingo
Post by Chris Marshall
Take a look at PDL::Dims.
Is there a way to use hash-like keys for the rows ?
I mean w/o using external hash-to-idx map..
-------| http://ifni.co
_______________________________________________
PDL-porters mailing list
http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
_______________________________________________
PDL-porters mailing list
http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
Chris Marshall
2014-12-12 15:57:15 UTC
Permalink
I'd like to put a plug in here for what I call
PDL3 "use cases" where you give a short
example of code showing what you would
like to be able to do, and if you know the
equivalent that would be helpful as well.

For this specific example, I can think of a
number of options for implementations that
might be investigated. One possibility is
that a dimension could be "index named"
via an index_name hash and then slice
might do the lookup for you in the call
with a specific value, passing the entire
index_name hash object might generate
a loop over all the index values...

Ingo, I know some of this maps into your
PDL::Dims features. Feel free to expand.

--Chris
Post by Ingo Schmid
thanks Chris for mentioning it. I just uploaded a new version. I'd
appreciate any feedback on usability, features, etc.
Ingo
Take a look at PDL::Dims.
Post by mraptor
Is there a way to use hash-like keys for the rows ?
I mean w/o using external hash-to-idx map.
Ingo Schmid
2014-12-12 16:14:03 UTC
Permalink
Post by Chris Marshall
I'd like to put a plug in here for what I call
PDL3 "use cases" where you give a short
example of code showing what you would
like to be able to do, and if you know the
equivalent that would be helpful as well.
For this specific example, I can think of a
number of options for implementations that
might be investigated. One possibility is
that a dimension could be "index named"
via an index_name hash and then slice
might do the lookup for you in the call
with a specific value, passing the entire
index_name hash object might generate
a loop over all the index values...
Ingo, I know some of this maps into your
PDL::Dims features. Feel free to expand.
The sln() function does that, just that unless you specify an index, the
whole piddle is returned. So you only need to supply those index names
which you want to restrict.

As Chris said, each dimension has its own hash, referred to by PDLs hdr
method(s).

pdl> p keys %{$x->hdr}
x dimnames y ndims


pdl> $x=xvals(10,12)+yvals(10,12)

pdl> p $x

[
[ 0 1 2 3 4 5 6 7 8 9]
[ 1 2 3 4 5 6 7 8 9 10]
[ 2 3 4 5 6 7 8 9 10 11]
[ 3 4 5 6 7 8 9 10 11 12]
[ 4 5 6 7 8 9 10 11 12 13]
[ 5 6 7 8 9 10 11 12 13 14]
[ 6 7 8 9 10 11 12 13 14 15]
[ 7 8 9 10 11 12 13 14 15 16]
[ 8 9 10 11 12 13 14 15 16 17]
[ 9 10 11 12 13 14 15 16 17 18]
[10 11 12 13 14 15 16 17 18 19]
[11 12 13 14 15 16 17 18 19 20]
]


pdl> initdim $x,'x'


pdl> initdim $x,'y'

pdl> p sln $x

[
[ 0 1 2 3 4 5 6 7 8 9]
[ 1 2 3 4 5 6 7 8 9 10]
[ 2 3 4 5 6 7 8 9 10 11]
[ 3 4 5 6 7 8 9 10 11 12]
[ 4 5 6 7 8 9 10 11 12 13]
[ 5 6 7 8 9 10 11 12 13 14]
[ 6 7 8 9 10 11 12 13 14 15]
[ 7 8 9 10 11 12 13 14 15 16]
[ 8 9 10 11 12 13 14 15 16 17]
[ 9 10 11 12 13 14 15 16 17 18]
[10 11 12 13 14 15 16 17 18 19]
[11 12 13 14 15 16 17 18 19 20]
]


pdl> p sln $x,'x',3

[
[ 3]
[ 4]
[ 5]
[ 6]
[ 7]
[ 8]
[ 9]
[10]
[11]
[12]
[13]
[14]
]

pdl> p sln $x,x=>"1:5:2",y=>"3:7:2"

[
[ 4 6 8]
[ 6 8 10]
[ 8 10 12]
]


Ingo
Post by Chris Marshall
--Chris
thanks Chris for mentioning it. I just uploaded a new version. I'd
appreciate any feedback on usability, features, etc.
Ingo
Post by Chris Marshall
Take a look at PDL::Dims.
Is there a way to use hash-like keys for the rows ?
I mean w/o using external hash-to-idx map.
mraptor
2014-12-19 05:42:03 UTC
Permalink
At the moment I use 2 DBM's to store the keys for the x and y axes. It
does not burden me that much, because the main calculation does not
depend on that.. but once I get more time I will look in more detail.

thanks
-------| http://ifni.co
Post by Chris Marshall
I'd like to put a plug in here for what I call
PDL3 "use cases" where you give a short
example of code showing what you would
like to be able to do, and if you know the
equivalent that would be helpful as well.
For this specific example, I can think of a
number of options for implementations that
might be investigated. One possibility is
that a dimension could be "index named"
via an index_name hash and then slice
might do the lookup for you in the call
with a specific value, passing the entire
index_name hash object might generate
a loop over all the index values...
Ingo, I know some of this maps into your
PDL::Dims features. Feel free to expand.
--Chris
Post by Ingo Schmid
thanks Chris for mentioning it. I just uploaded a new version. I'd
appreciate any feedback on usability, features, etc.
Ingo
Take a look at PDL::Dims.
Post by mraptor
Is there a way to use hash-like keys for the rows ?
I mean w/o using external hash-to-idx map.
Loading...