Vocabulary/dollardot

From J Wiki
Jump to: navigation, search

>> <<   Down to: Dyad   Back to: Vocabulary Thru to: Dictionary

$. y Sparse

Rank Infinity -- operates on x and y as a whole -- WHY IS THIS IMPORTANT?



Gives a noun that can replace (numeric) y in working code, with only the non-zero atoms of $.y stored in memory. See the entry in the J Dictionary for details

When $.y is displayed in the J session, only its non-zero atoms are shown, together with their indexes.

   $ y=: 0 0 1 0 2.5 0 0 999 _ 0 0 0
12
   ] z=: $.y
2 |   1
4 | 2.5
7 | 999
8 |   _
   $ z
12

Common uses

To save storage when storing a sparse array.


x $. y Sparse

Rank Infinity -- operates on x and y as a whole -- WHY IS THIS IMPORTANT?



n&$. is a collection of functions for creating and handling sparse arrays and converting them to/from ordinary arrays.

The noun n can take one of the values 0 1 2 3 4 5 7 8 or their negations. See the entry in the J Dictionary for details of the actual function specified by n plus the form of the y-argument it expects.