Announcement

Collapse
No announcement yet.

How to use MAT statement multiplication?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Eros Olmi
    replied
    Not tested but ...

    I suspect MAT works on arrays and not on UDT (even if it just contains a single array)

    Use a dummyarray dimensioned with DIM ... AT ... at the same location of VARPTR(YourUDT)

    Added - OPS: sorry, you already solved the problem.
    Last edited by Eros Olmi; 4 Jul 2008, 04:17 AM.

    Leave a comment:


  • Patrice Terrier
    started a topic How to use MAT statement multiplication?

    How to use MAT statement multiplication?

    I would like to perform matrix multiplication using the MAT statement.

    The documentation says the syntax to use is:
    MAT a1() = a2() * a3() 'Multiplication

    however i can't get it to work

    Code:
    TYPE ColorMatrix
        m(0 TO 4, 0 TO 4) AS SINGLE
    END TYPE
    
    FUNCTION PBMAIN
    
    DIM cM, cC, cB AS ColorMatrix
    
    MAT cM() = cC() * cB()
    
    END FUNCTION
    The compiler says:
    Error 437 in test.bas(7:005): AS expected
    Line 7: DIM cM, cC, cB AS ColorMatrix

    I must say that i do not undertsand what i am doing wrong



    Added:
    looks like i have to DIM it that way
    DIM cM(0 TO 4, 0 TO 4) AS SINGLE, cC(0 TO 4, 0 TO 4) AS SINGLE, cB(0 TO 4, 0 TO 4) AS SINGLE

    Would be nice if it could also work directly with a structure type definition.

    ...
    Last edited by Patrice Terrier; 4 Jul 2008, 02:57 AM.
Working...
X