Tracy wrote:

>My understanding is that numeric values are handled in a manner 
>such that the J user (normally) should not put any thought to
>how a number is implemented.

No worries, that's true in this case too.  If you amend a sparse array with a 
"higher" numeric datatype, the array will be automatically and transparently 
promoted, as usual.

>I do not understand why floating point is specified
>here.  

Probably for simple efficiency purposes.  Roger's betting that the average 
sparse-array user will want floating points.  For matrix division, perhaps.  (I 
know Matlab's arrays are floats by default.)

Promoting an array isn't free, and if you know (or can guess with a good 
probability) that the array will "go floating" at some point, it's faster to 
start it off that way.

If you don't need floats and don't want to pay the price in terms of time, 
space, and complexity (tolerance), then the  e  part gives you the option of 
using a "lower" datatype. 

Conversely...

> What differences may occur if e is specified as 0j0?

if you need more power, you can specify an even higher datatype.  The only 
difference being the amount of space and time array operations take, and the 
internal representation of those arrays (modulo bugs).  Just like everywhere 
else in J.

But be careful, J's constant notation is a little tricky.  The number  0j0  
isn't what you think it is:

           datatype  0j0
        boolean

So, to answer your question: 

> If e is explicitly asserted as 0, will it be implemented as binary?    

Yes, because the stand-alone constant  0  is interpreted as a boolean (in any 
context).

There are several ways to get a constant zero of type "t".  The most reliable 
is probably

           {. 0 , non_zero_type_t_number
        
as in
           {. 0 1j1

You can read more about constant notation pitfalls at 

   
http://www.jsoftware.com/jwiki/Guides/Constants#head-dd5d17611fae0ca16e2f401e2def8cd989493567

-Dan


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to