Fearless Fool wrote in post #965610: > This question may be so obvious that even Marnen won't answer it... :) > > I need to store a set of relatively complex objects in the db -- in my > case, these are discrete cumulative distribution functions: they take a > long time to construct, but I want the lookup to be fast. Since the > lookup is essentially a binary search, a B-Tree or some variant would be > a sensible data structure. > > I have choices: (a) I store entire YAML'd B-Trees, (b) I store simple > data structure (e.g. arrays of numeric pairs) and spend time > constructing a B-Tree from it, or (c) choose another approach that > someone on this list points out. > > - ff
Tough to call... What's your intended usage scenario? Depending on the resolution required from the CDF, could you just store built distributions in a table and query against it? With normalized inputs and the right indices, the query should be fast, and trading off record count versus accuracy, you could always do a linear interpolation between any two stored points. Need higher interpolated accuracy? Then increase the resolution of stored points to minimize the interpolated gap. Ugh... I gave up the practice of sadistics years ago, and now you're making me remember it... Curse you Red Baron! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.