All pastes #84685 Raw Edit

Untitled

public text v1 · immutable
·published 2006-07-11 06:27 UTC
rendered paste body
<kumpakan> hello
<Mulder_> hi
<kumpakan> I had an interesting idea earlier, hoping someone will listen
<kumpakan> say I have a collection of data tagged w/ keywords
<kumpakan> I want to be able to match those data by the keywords
<kumpakan> as data are interned in a structure responsible for managing them, each keyword gets a unique positive integer
<kumpakan> we'll start at 1...
<kumpakan> so, we'll say there's an article object with keywords foo, bar, and baz
<kumpakan> foo has been interned already, its number is 3...bar and baz are new and get the integers 8 and 9
<kumpakan> the structure is then associated with all the (x + n) ... polynomials that can be formed with these numbers using a multidimensional array
* gaff has quit (Connection timed out)
<kumpakan> so we have x^2 + 11x + 24, x + 9, etc...
<kumpakan> the first coefficient will always be 1, so it can be factored out altogether
* Manyfold has quit (Read error: 104 (Connection reset by peer))
* mElo97 (n=0x0Fab@AStDenis-104-1-21-41.w80-8.abo.wanadoo.fr) has joined #math
* justinca (n=jkhm@pdpc/supporter/student/justinca) has joined #math
<kumpakan> then these combinations are interned in the multidimensional array along with the total number of terms associated with the number
<kumpakan> on second thought, this will produce some very big numbers an a lot of wasted space
<kumpakan> if you have results like x^3 + 20 x^2 + 103x + 216, then you will get array indices [20]->[103]->[216]
<kumpakan> this might pay in the long run, but you could also consider splitting up the numbers by place value
<arctanx> and how do you plan to extract the factors? and when you have them, what do they mean?
<kumpakan> [2]->[0]->[1]->[0]->[3]->[2]->[1]->[6], etc
<kumpakan> arctanx, you don't need to extract them
<kumpakan> say you are looking for all 'bar' and 'baz' items
<arctanx> oh right, matching data
<kumpakan> IIRC, I said the numbers were 8 and 9
<arctanx> the fastest and most memory efficient way to do that would be a bit mask
<kumpakan> so, x^2 + 17x + 72
* jcsteele has quit (Read error: 110 (Connection timed out))
<kumpakan> arctanx, ?
<arctanx> just assign different keywords to different powers of 2, and bitwise and your mask against each set of data
<arctanx> are you using some kind of program on the computer to do this?
<kumpakan> arctanx, this is theoretical right now
<kumpakan> I'm sure it's been done to death, I just want to see if there is any validity to my idea
<kumpakan> so, anyway, you are looking for all 'bar' and 'baz', this yields the polynomial x^2 + 17x + 72
* Appleman1234 (n=Appleman@CPE-124-185-115-49.qld.bigpond.net.au) has joined #math
<kumpakan> again, the first coefficient is always 1, so ignore it...using the (bad) array scheme I described earlier, this would go to [17]->[72]
<kumpakan> under [17]->[72] is another array, it starts at one and each index holds all the items that can be identified by the polynomial described above (17,72)...the index itself tells you how many terms are associated with the item
<kumpakan> so, if you were looking for JUST 'bar' and 'baz', you want all the items under [17]->[72]->[2]
<kumpakan> if you want everything /with/ the tags 'bar' and 'baz' (and 'foo', 'qux', whatever other qualifiers, if any), you would get the data under [17]->[72]->[2..n], not just [17]->[72]->[2]
<kumpakan> I hope this makes sense