|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I would like to store data and associated data covariance in an SQL database. Every day we generate a list of positions for a network of GPS receivers. Each position consists of a coordinate triple corresponding to a unique station at a unique time.
Suppose we have 20 stations, this entails 60 data points per day. No big deal, but we also must store the 60x60 covariance matrix which contains crucial information about the uncertainties of the data. Years of data will then have a giant (mostly sparse, since individual days are indepedent) covariance matrix associated with it. I realize there is no native support for a matrix data type in SQL. I've come up with several ways of storing the covariance matrix, but none is efficient (i.e., certain important queries take too long to execute). I'd appreciate any relevant thoughts. |
|
#2
|
|||
|
|||
|
Well, it depends primarily on the 'certain important queries'. Perhaps you could
explain them. Solution 1: the obvious solution: GPS_ID INT COVARIANCE_VALUE DOUBLE INDEX_X TINYINT /* 0 - 59 */ INDEX_Y TINYINT /* 0 - 59 */ Solution 2: store entire covariance matrix on one long, fixed-width text string. You could make each field fixed width, so if you wanted 10 digits of precision for each field the text string would be exactly 10 * 60 * 60 characters long. This would make searching on a specific field easy. You could remove all decimal points and just use an implied decimal point. Or you could store every field in scientific notation. Solution 3: use RLE, Run-Length Encoding. Compress the matrix into one text string by encoding the portions of the matrix that are the same. Example: If the first 5 cells in the matrix are zeros, and the next cell is 1.23, and the following 6 cells are zero, the encoding could be something like: R5V0 1.23 R6V0 It all depends on what type of queries on this data you plan on doing. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Database design -- storing sparse matrices |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|