Hi
I'm using a couple of same-size tables to store tuples of numbers so that their index is there ID. When (tab)reading all tables at the given index, I get back the hole tuple. Mostly I have an ID and I need to look up some value which is obviously an inexpensive task.
But sometimes I know two values (the combination of the two values is unique) and I need to find the corresponding ID (index where both values are found in their respective tables). I'm currently doing a reverse lookup by scanning the table(s) which is more expensive than the forward lookup.
Let's assume memory usage is less of a concern, is there an complementary way to store the data (x tuples of same size) that allows for a quick reverse lookup?
ID -> (x, y): easy
(x, y) -> ID: ??
Roman
The "equals" method of [tabletool] returns the indices of a value you're searching for, as well as the number of occurrences.
On Tue, Sep 4, 2018, 5:19 PM Roman Haefeli reduzent@gmail.com wrote:
Hi
I'm using a couple of same-size tables to store tuples of numbers so that their index is there ID. When (tab)reading all tables at the given index, I get back the hole tuple. Mostly I have an ID and I need to look up some value which is obviously an inexpensive task.
But sometimes I know two values (the combination of the two values is unique) and I need to find the corresponding ID (index where both values are found in their respective tables). I'm currently doing a reverse lookup by scanning the table(s) which is more expensive than the forward lookup.
Let's assume memory usage is less of a concern, is there an complementary way to store the data (x tuples of same size) that allows for a quick reverse lookup?
ID -> (x, y): easy
(x, y) -> ID: ??
Roman _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Hi William
On Tue, 2018-09-04 at 19:51 -0400, William Brent wrote:
The "equals" method of [tabletool] returns the indices of a value you're searching for, as well as the number of occurrences.
Thanks. That's quite a cool external and definitely covers what I need.
I'm still curious, though, if it's possible to implement a lookup and reverse lookup in a way that does not require a scan.
Roman
On Tue, Sep 4, 2018, 5:19 PM Roman Haefeli reduzent@gmail.com wrote:
Hi
I'm using a couple of same-size tables to store tuples of numbers so that their index is there ID. When (tab)reading all tables at the given index, I get back the hole tuple. Mostly I have an ID and I need to look up some value which is obviously an inexpensive task.
But sometimes I know two values (the combination of the two values is unique) and I need to find the corresponding ID (index where both values are found in their respective tables). I'm currently doing a reverse lookup by scanning the table(s) which is more expensive than the forward lookup.
Let's assume memory usage is less of a concern, is there an complementary way to store the data (x tuples of same size) that allows for a quick reverse lookup?
ID -> (x, y): easy
(x, y) -> ID: ??
Roman _______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/l istinfo/pd-list