i have a class called gridPartition.
there are many gridPartition objects in my code, each of which represents a division of a large matrix in memory. two different gridPartition objects can refer to TWO DIFFERENT MATRICES in memory so i can't use a static variable for this because that would require that a single matrix object be common to ALL gridPartition objects.
On the other hand, I don't want ot make a bazillion copies of this huge data object because one is attached to each gridPartition object.
how do I need to declare the matrix property of my gridPartition class? i'm vaguely familiar with the & operator, but am confused here.
here's how i create a gridPartition object:
$p = new gridPartition($x0, $xn, $y0, $yn, $matrix);
should that be &$matrix?
and my class might look something like this:
class gridPartition {
var $x0;
var $xn;
var $y0;
var $yn;
var $total;
function gridPartition($x0, $xn, $y0, $yn, $matrix) {
$this->x0 = $x0;
$this->xn = $xn;
$this->y0 = $y0;
$this->yn = $yn;
$this->total = 0;
for($x=$x0; $x<$xn; $x++) {
for($y=$y0; $y<$yn; $y++) {
$this->total += $matrix[$x][$y];
} // for y
} // for x
} // gridPartition()
} // gridPartition
any help is much appreciated.