Announcement

Collapse
No announcement yet.

How to use MAT statement multiplication?

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

  • 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, 03:57 AM.
    Patrice Terrier
    www.zapsolution.com
    www.objreader.com
    Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

  • #2
    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, 05:17 AM.
    thinBasic programming language
    Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

    Comment

    Working...
    X