Thank you so much for your help!

First I defined the size of matrix by i,.j - everything works just fine.

But an idea occured to my mind... Maybe I am not at the right
point when using the matrix formulation when solving my task?

If you:

a) sort the table T(i, j, v) by i value;

b) find the beginning and the end of the ranges for each unique value i (let's 
call them u);

c) create a loop by u, and pull the necessary ranges with j and v from the T 
table;

d) apply necessary calculations to the data which are pulled from the other 
places by j value.

Suppose in case we arrange the things this way - this will not be much slower
than the matrix formulation method, am I right?

Cheers.



> a. Currently, mapped files do not support the sparse datatypes.
> 
> b. You can do this in one of two ways:
>    s=: 1 $. 1e8 1e8 ; 0 1;-~0.5
>    s=: value (<"1 i,.j)}s
> Or
>    s=: 1 $. 1e8 1e8 ; 0 1; (-~0.5) ; (i,.j) ; value
> (The latter is not yet documented but should work in
> J602 beta.)
> 
> A sparse matrix can be converted to the equivalent dense
> matrix by   d=: $.^:_1 s .
> 
> Note that with your full problem, a 1e8 1e8 matrix with 10e9 
> non-zero atoms, there is no advantage to making it a sparse
> matrix, because as stated before the primitive %. and 
> +/ .* are not up to dealing with an array of that size.
> Better to just map i and j and values separately 
> (perhaps i,.j and value as two map files), and apply your
> iterative methods to these.
> 
> Perhaps I should add the problem you described is a
> non-trivial application.
> 
> 
> 
> ----- Original Message -----
> From: Nick Kostirya <[EMAIL PROTECTED]>
> Date: Wednesday, January 9, 2008 23:04
> Subject: [Jgeneral] table (i,j,value)  to matrix
> To: [email protected]
> 
> > Hello,
> > 
> > I proceed with my studies of J, well I have a couple of 
> > questions for
> > you. 
> > 
> > As far as I understand, а sparse matrix can't mapped as file, am 
> > I right?
> > 
> > Second, what's the most optimal way of converting a table
> > (i,j,value) into matrix, preferably a sparse one? Can't really get
> > the clue... I am also interested in the process of reverse
> > conversion...
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to