Menu

#3164 read_matrix issues

None
open
nobody
5
2024-06-03
2016-05-23
No

Some bad cases for read_matrix (file contents on left, results on right):

4+5 => [[4,5]]
, => [false,false]
<zero-length file=""> => matrix() << correct
<file with="" one="" empty="" line=""> => matrix([false]) << should be matrix([])
-x => matrix([-x]) (== -1 * x) << should be error
-1*x => matrix([[-1,?*,x]]))
"a => matrix(["a "])</file></zero-length>

Results depend on the input file name (!!!):

In file t10.csv:
1,-x,"sdf" => [1, -x, "sdf"]
Identical contents, but named t10.com:
1,-x,"sdf" => matrix([ 1, ?, , -x , ?, , "sdf" ])

BTW if you want to test these, note that ? is Lisp's , and will actually have a value; you need to quote it.

Discussion

  • Stavros Macrakis

    The different behavior based on input file name is actually described in manual section 73.1.2:
    "If the file name ends in something other than .csv' andseparator_flag' is not specified, `space' is assumed."

    So the t10.com case should presumably be returning matrix(["1,-x,\"sdf\""]) (because there are no spaces) or giving an error (because that is not numerical).

     
  • Robert Dodier

    Robert Dodier - 2024-06-03
    • labels: --> numericalio, read_matrix
     

Log in to post a comment.