[Geowanking] RE: Geowanking Digest, Vol 50, Issue 33
anselm at gmail.com
Mon Jan 21 19:24:49 PST 2008
Hey we even found something geo related to talk about here :-)
Which happens to write a 5 to NULL. But you can also do things like this:
> int * i = malloc(sizeof(int) * 10);
> for (int j = 0; j < 10, *i=j; j++, i++)
> Which happens to be a really unmaintable way to make an array of 10
> numbers, 0-9. But there are times when that's really handy. And
> double-dereferencing is a breeze, so sparse arrays can be efficient ( e.g.,
> dealing really big numerical solutions with millions of variables - like a
> lot of raster analysis).
To elaborate a bit on this pointer thing in java, I did find this nice
And of course there is lapack - which has sparse matrix solutions simply as
a side-effect of being able to crunch large sets of linear equations....
But in my case I wanted arbitrary structures in the cells, and as well I
wanted not just sparse matrices but to compress away duplicate regions.
Specifically the interest is in taking an SRTM of Oregon at some low
resolution, and trying to compute water flow across the watershed among
other things - mostly to explore how human activity affects salmon
So you can imagine that there's going to be a 2 dimensional array of say
1,000,000 elements by 1,000,000 elements - perhaps 8 to 16 bytes per
element; depending on how much state I wanted to represent. Initially I was
thinking of modeling slope of terrain, water depth at point, temperature at
point and then later I wanted to model salmon populations, pollutants,
sediment and the like.
Beyond this the interest was in not just 'running the model' myself but
making it a kind of web 2.0 site where people could mess with the models -
painting new dams or whatever - so there could be multiple instances of the
same dataset; being computed forward at different points in time per
For efficiency one would want to compress away any duplication; any blocks
of terrain that are in the same state - both within a single instance and
across multiple instances... Hence the need for a custom solution for
storing state; something that probably starts to look more like jpeg or um
some kind of fractal compression I guess. Me shrugs.
In any solution one has some indirection; you could represent the problem as
a hashed tree of some kind; like a quad-tree or maybe something that splits
faster like with 256 branches per leaf. But to address any single cell you
want to minimize the number of dereferences... because you want to stride
across successive memory regions, for cache coherence, dma, bus-architecture
Of course a thousand thousand graduate students have probably already done
But in any case it was in this process of implementing this sketch that I
found myself hitting limits that I normally never notice in Java... And I
did see in languages like C# and the like much more support for this
natively - via value types and sparse matrix support...
Hope some of this makes sense... It's some unfinished thinking to be
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Geowanking