As you first begin you want to create atoms,lists and tables as you need and use them. As you get more experience you will have more tables and higher dimension arrays.
As you do so, you will often have to "manipuladte" lower dimension date to a shape that will allow you to use verbs with it and those higher dimension arrays. This is when you will want to change yhou list into a new shape so you can multiply it by the other noun. My best advide is to use the simplest form you can. When you need to make it a more comples versio like a vector to a matric will be when you need to experiment until you get the array you want. Linda -----Original Message----- From: Programming [mailto:[email protected]] On Behalf Of Henry Rich Sent: Sunday, April 16, 2017 3:16 PM To: [email protected] Subject: Re: [Jprogramming] J weirdness #1 Focusing on the final question: Why does J not treat a column of numbers as a N by 1 'matrix' ie a vector rather than a list? If you had asked 'Why does readtable not...' I would have answered that it might be a bug in readtable, or that you should have some intermediate verb that would guarantee that you get a table result: readrank2 =: ,.^:(2 > #@$) @ readtable NB. untested Following Chris's explanation of where the trouble comes from (that ". sometimes produces a list, sometimes an atom), another way to force the behavior you want would be to replace ". by (,@".) which would always produce a list. As for 'Why does J not...', how would J know that this list should be treated as a one-column table, rather than a one-row table, a one-row brick, etc.? Henry Rich On 4/16/2017 2:26 PM, Michael Goodrich wrote: > All, > > In using 'readtable' as defined in the primer I find the following > situation: > > Reading in a square matrix from a file with each row of numbers on a > line I always get the 'correct' answer when asking about the shape of > the read in data, EXCEPT when the data has only one value per line ie > is a vector or de-generate matrix if you will. In that case the shape > comes back with a single number say N whereas I was expecting it to > say 'N 1' and indeed the read in data is not available for linear > algebra operations whereas data with more that one column is without further > ado. > > Why does J not treat a column of numbers as a N by 1 'matrix' ie a > vector rather than a list? > > (Pardon me if I sound like I am whining ;-) > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm --- This email has been checked for viruses by AVG. http://www.avg.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
