On 31 Aug 2009, at 11:10 AM, Igor Peshansky wrote:
>> tmp_fs_real and tmp_fs_image are Rails[Double].
>>
>> val real = tmp_fs_real;
>> val image = tmp_fs_image;
>>
>> val Mc_tmp = Mc; //just made this change
>> val N_tmp = N; // and this one
>> regionS = [0..N_tmp-1, 0..Mc_tmp-1];
>> distS = Dist.makeBlock(regionS,0);
>> S = Array.make[Complex](distS,
>> (val (i,j):Point) => new Complex ( real(i*Mc_tmp+j), image
>> (i*Mc_tmp+j) ) );
>
> Ah. I kept thinking of real() and image() as functions, but they
> are, in fact, Rails... That would explain it: Rails are objects,
> and thus live in the place they were created. So, accessing them
> from another place will give you a BadPlaceException.
>
> One possible solution is to make them ValRails (if the algorithm
> allows this). Another is to send the relevant bits using ValRails
> into other Rails that live in the appropriate places.
Here's what I have:
The values of tmp_fs_real and tmp_fs_image are read from a file. I
then need to pair up each tmp_fs_real(n) with tmp_fs_image(n) for S(n).
try{
inputStream = new FileReader( new File(file_path) );
tmp_fs_real = Rail.makeVal[Double](Mc*N, (i:int) => 0.0);
tmp_fs_imag = Rail.makeVal[Double](Mc*N, (i:int) => 0.0);
for (i = 0; i < Mc*N; i++){
tmp_fs_real(i) = inputStream.read( LSB.DOUBLE );
}
for (i = 0; i < Mc*N; i++){
tmp_fs_imag(i) = inputStream.read( LSB.DOUBLE );
}
inputStream.close();
val real = tmp_fs_real;
val imag = tmp_fs_imag;
/*simulated SAR signal array*/
val Mc_tmp = Mc;
val N_tmp = N;
regionS = [0..N_tmp-1, 0..Mc_tmp-1];
distS = Dist.makeBlock(regionS,0);
S = Array.make[Complex](distS,
(val (i,j):Point) => new Complex ( real(i*Mc_tmp+j), imag
(i*Mc_tmp+j) ) );
I will eventually use FFT on S, which is where the work is, so I
assume S should be distributed for the work. The API for Rail makes it
look like makeVal() returns a ValRail. The above code still throws the
BPException.
Jim
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users