Tcl Library Source Code

View Ticket
Login
Ticket UUID: 743f95e16d913db1208af98a72517962e3e45348
Title: matrices cannot be a single column
Type: Bug Version: 1.20
Submitter: msoyka Created on: 2023-06-28 18:26:29
Subsystem: math :: linearalgebra Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2023-06-28 18:26:29
Resolution: None Closed By: nobody
    Closed on:
Description:
Although one can create a one-column matrix using "mkMatrix", the "shape" proc  incorrectly identifies it as a vector.  As a result, other procs that expect matrix arguments may fail.  For example, statements such as:

    foreach {nrows ncols} [shape $matrix] {break}

will return only one dimension, leaving "ncols" undefined.

I think that this is due to Tcl's inability to distinguish a single element list such as {1.0} from a non-list value.  Assuming this to be true, I don't see an easy fix.  Perhaps all that can be done is to add a warning/alert to the documentation?