Skip to content

2x2 multiplication bug #41

@JolifantoBambla

Description

@JolifantoBambla

I think m2:* has a bug which might be related to #29.

On SBCL 2.0.0:

CL-USER> (m2:* (m2:make 1.0 2.0
                        3.0 4.0) 
               (m2:identity))
#(1.0 3.0 2.0 4.0) ;; this is correct

CL-USER> (m2:* (m2:identity)
               (m2:make 1.0 2.0
                        3.0 4.0))
#(1.0 2.0 3.0 4.0) ;; should be #(1.0 3.0 2.0 4.0)

;; 1 2   5 6 | 19 22 
;; 3 4   7 8 | 43 50
CL-USER> (m2:* (m2:make 1.0 2.0
                        3.0 4.0)
               (m2:make 5.0 6.0
                        7.0 8.0))
#(26.0 30.0 38.0 44.0) ;; should be #(19.0 43.0 22.0 50.0)

;; to get the result wanted above, the matrix components have to be swizzled around:
CL-USER> (m2:* (m2:make 5.0 6.0
                        7.0 8.0)
               (m2:make 1.0 3.0
                        2.0 4.0))
#(19.0 43.0 22.0 50.0)

also: m:to-string does not work with m2 - I'm not sure if this is intended, since m:to-string is not documented, so I didn't open an extra issue:

CL-USER> (m:to-string (m2:identity))
; Evaluation aborted on #<SIMPLE-ERROR "~@<The assertion ~S failed~:[.~:; ~
                                           with ~:*~{~S = ~S~^, ~}.~]~:@>" {100558EEA3}>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions