Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB.net: Multiplying matrices using arrays.....

  • 18-03-2005 03:09PM
    #1
    Registered Users, Registered Users 2 Posts: 326 ✭✭


    Ok, I was just being lazy by trying to get the full answer to my assignment by asking for the full answer!! But, now i've a more specific problem for this assignment.

    How exactly do you multiply 2 (3 by 3) matrices together using arrays in VB.net? There is surely a shorter way of doing it than simply typing out the full formula for multiplying two 3*3 matrices i.e. array(1,2)*array(1,1), etc.

    Thanks!


Comments

  • Moderators, Society & Culture Moderators Posts: 9,688 Mod ✭✭✭✭stevenmu


    I can't remember how matrices are multiplied together but I'm thinking that to code it you need to be using nested for loops e.g.
    FOR x = 1 TO 3
       FOR y = 1 TO 3
          'Do something with x and y here
       LOOP
    LOOP
    


  • Registered Users, Registered Users 2 Posts: 326 ✭✭BangBeater


    thanks. I'm trying something like that at the moment, bt havn't got it working yet.


  • Closed Accounts Posts: 5 FunBobby


    I'm not sure if this is exactly what you want, but if its not please reply:

    If you have two (3,3) matrices (or two-dimensional arrays) called A and B,
    to multiply each cell in Matrix A by its corresponding cell in Matrix B, to produce a resultset Matrix C :


    For x = 0 to 2 ' Loop (along the columns)
    For y = 0 to 2 ' Loop (within each column along the rows)
    C(x,y) = A(x,y) * B(x,y)
    Print "C" & x & y & "=" C(x,y)
    Next y
    Next x

    (Assumes your matrix is zero based)


Advertisement