Menu

#3458 addcol mishandles empty matrix as first argument

None
closed
nobody
5
2018-08-20
2018-08-04
dan hayes
No

wxMaxima version: 13.4.0
Maxima version: 5.31.1
Maxima build date: 2013-09-24 09:49:12
Host type: i686-pc-mingw32
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.8

Matrix interpretation WRONG in maxima. Does the same thing whether it is
addrow or addcol. When use addcol to cv below should interpret it as a single column matrix
but it does NOT. And one must transpose it to have it interpreted correctly
when one certainly should NOT need to do so. If use cv:addrow(cv,....) then yea logically one would have to transpose
but should NOT when use addcol. Example cv in the following should be a column vector but maxima does
not interpret it that way. It does exactly the same whether use addcol OR addrow in defining cv - always interprets it
as a row matrix.

(xmat:matrix([2,1,3],[5,4,9],[3,2,1]),
xmat:addrow(xmat,xmat[1]),
xmat:addrow(xmat,xmat[2]-xmat[3]),
cv:matrix(),
cv:addcol(cv,sum(xmatr[i],i,1,3)),
cx:transpose(xmatr[1]),
ldisp(["xmat",xmat,"cx",cx]),
cx:cx+cv,  
ldisp(["cx",cx]))  
/* get ERROR here and in order NOT to get error must use 
cx:cx+transpose(cv)   instead of just cx:cx+cv  */

Discussion

  • Robert Dodier

    Robert Dodier - 2018-08-18
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -13,8 +13,16 @@
     not interpret it that way. It does exactly the same whether use addcol OR addrow in defining cv - always interprets it
     as a row matrix.
    
    -(xmat:matrix([2,1,3],[5,4,9],[3,2,1]),xmat:addrow(xmat,xmat[1]),xmat:addrow(xmat,xmat[2]-xmat[3])
    -,cv:matrix(),cv:addcol(cv,sum(xmatr[i],i,1,3)), cx:transpose(xmatr[1])
    -,ldisp(["xmat",xmat,"cx",cx])
    -,cx:cx+cv,  ldisp(["cx",cx])         )  /* get ERROR here and in order NOT to get error must use 
    +~~~~
    +(xmat:matrix([2,1,3],[5,4,9],[3,2,1]),
    +xmat:addrow(xmat,xmat[1]),
    +xmat:addrow(xmat,xmat[2]-xmat[3]),
    +cv:matrix(),
    +cv:addcol(cv,sum(xmatr[i],i,1,3)),
    +cx:transpose(xmatr[1]),
    +ldisp(["xmat",xmat,"cx",cx]),
    +cx:cx+cv,  
    +ldisp(["cx",cx]))  
    +/* get ERROR here and in order NOT to get error must use 
     cx:cx+transpose(cv)   instead of just cx:cx+cv  */
    +~~~~
    
     
  • Robert Dodier

    Robert Dodier - 2018-08-18

    Reformatting code with four tildes and breaking lines for greater clarity.

     
  • Robert Dodier

    Robert Dodier - 2018-08-18
    • labels: --> addcol, matrix
     
  • Robert Dodier

    Robert Dodier - 2018-08-20
    • summary: does not interpret addcol as it should but instead interprets same as addrow --> addcol mishandles empty matrix as first argument
    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 2018-08-20

    Fixed by commit 7aabe5fa, therefore closing this report. I've adjusted the title to make it clearer what the problem was.

     

Log in to post a comment.

MongoDB Logo MongoDB