On 5/20/06, Brannon King <[EMAIL PROTECTED]> wrote:
So here's the real problem. Sorry about the long explanation, but if
anyone wants to help with the query, that would be great. I have a 2d
sparse matrix in a table where each point has two values, a score and a
diagonal run count. In other words, my table has four columns:
x,y,score,drc. Even though a certain x,y does not show up in the table,
we can still calculate its score value by finding a piece farther along
on the same diagonal using this formula:

score(x,y) = max(score(x+n,y+n)-n*penalty) where n < drc(x+n,y+n) < 256

So at some 'sample' you have the score and drc, but not the x,y value?
The x,y values can be interpolated using some algebra and the surrounding
samples?

The values of x and y would be from a 'correlated subquery'. You need
to establish
some way the database engine can pick the correct sample to use in the
calculation.
That is usually done by adding a primary key column with a numerical number
for each sample. You can then say for sample N's calculation use the x,y value
from sample N+4 (or whatever).

--
SqliteImporter, SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Reply via email to