Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8690

Re: How best to implement a hash table in Mathematica

From Joseph Gwinn <joegwinn@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How best to implement a hash table in Mathematica
Date 2012-02-22 10:36 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ji2gg3$kcu$1@smc.vnet.net> (permalink)
References <jho21j$5sb$1@smc.vnet.net> <jhqmsq$fbt$1@smc.vnet.net> <jhstus$nku$1@smc.vnet.net> <jhvu5c$80d$1@smc.vnet.net>

Show all headers | View raw


In article <jhvu5c$80d$1@smc.vnet.net>,
 Richard Fateman <fateman@cs.berkeley.edu> wrote:

> On 2/19/2012 11:49 PM, Joseph Gwinn wrote:
> > In article<jhqmsq$fbt$1@smc.vnet.net>,
> >   Richard Fateman<fateman@cs.berkeley.edu>  wrote:
> 
> >> Initializing a hashtable with 10^4 (identical?) empty keys makes no
> >> sense. Did I misunderstand your message?
> >
> > No, you understood correctly.  Please see my response to David Bailey
> > for the rationale.
> >
> > Joe Gwinn
> >
> Again, I may misunderstand, but I think you can accomplish the same 
> thing by typing
> 
> f[x_]:= {}
> 
> if {} is the default empty value.

This creates the hashtable, and gives it a name.  In a hashtable, it is 
not the table that's empty, it's this or that specific cell that's 
empty, in an unpredictable and changing pattern.  So one would be 
attempting to update and access f[x], where x is a random integer.  So, 
I just tried this, and it works just fine, including handling variable 
lists.

So, this and related approaches may be workable.  I will have to 
implement them in a real application, and check performance and 
scalability.

Joe Gwinn

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-18 11:28 +0000
  Re: How best to implement a hash table in Mathematica Szabolcs Horvát <szhorvat@gmail.com> - 2012-02-19 11:29 +0000
    Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-20 07:50 +0000
  Re: How best to implement a hash table in Mathematica David Bailey <dave@removedbailey.co.uk> - 2012-02-19 11:36 +0000
    Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-20 07:48 +0000
      Re: How best to implement a hash table in Mathematica A Retey <awnl@gmx-topmail.de> - 2012-02-21 11:20 +0000
        Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-22 10:36 +0000
      Re: How best to implement a hash table in Mathematica Szabolcs Horvát <szhorvat@gmail.com> - 2012-02-21 11:21 +0000
        Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-22 10:35 +0000
  Re: How best to implement a hash table in Mathematica Richard Fateman <fateman@cs.berkeley.edu> - 2012-02-19 11:36 +0000
    Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-20 07:49 +0000
      Re: How best to implement a hash table in Mathematica Richard Fateman <fateman@cs.berkeley.edu> - 2012-02-21 11:11 +0000
        Re: How best to implement a hash table in Mathematica Joseph Gwinn <joegwinn@comcast.net> - 2012-02-22 10:36 +0000
  Re: How best to implement a hash table in Mathematica Leonid Shifrin <lshifr@gmail.com> - 2012-02-22 10:34 +0000
    Re: How best to implement a hash table in Mathematica "Nasser M. Abbasi" <nma@12000.org> - 2012-02-23 10:51 +0000
  Re: How best to implement a hash table in Mathematica Leonid Shifrin <lshifr@gmail.com> - 2012-02-24 06:00 +0000

csiph-web