Results 1 to 8 of 8

Thread: Row order in matrix filling

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Row order in matrix filling

    Usually thinBasic matrix filling follows column order.
    Next thinBasic beta preview will have the possibility to fill matrix with row order.
    Also:
    • it will not be mandatory to indicate starting index during filling. If missing, 1 or 1,1 will be assumed
    • it will not be mandatory to add line continuation. When indicating data, if rows ends with a comma(,) it will be automatically considered as line continuation

    How: just using ( and ) before and after data.
    Example:
    Dim a(MaxX, MaxY) As Double
    
    a() = ( 1, 2, 3,
    4, 5, 6,
    7, 8, 9 )
    
    When using () syntax, data will be entered in the matrix in row order and now column order.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: Row order in matrix filling

    Thanks Eros,

    this is very much appreciated!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3

    Re: Row order in matrix filling


    Just to clarify,Eros.

    array(x,y) ?

    matrix(column,row) ?

    The x is the minor step and the y is the major step?


    Charles

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Row order in matrix filling

    a() = 1, 2, 3,
    4, 5, 6,
    7, 8, 9
    
    in memory would be filled following COLUMN order: 1, 4, 7, 2, 5, 8, 3, 6, 9
    Column order is the standard way used by thinBasic

    a() = ( 1, 2, 3,
    4, 5, 6,
    7, 8, 9 )
    
    in memory would be filled following ROW order: 1, 2, 3, 4, 5, 6, 7, 8, 9

    So () will influence the sequence in which data is entered in memory.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5

    Re: Row order in matrix filling

    Thanks Eros,

    As I understand it your first ( default order) follows the PB convention whereas your second way of entering data follows the C convention.

    FORTRAN MATLAB & PB: array(minor index,major index) : column major order

    C and most others: array(major index,minor index) : row major order


    http://en.wikipedia.org/wiki/Row-major_order

    I lose hours of sleep worrying about how matrices and other arrays are organised in memory

    Charles

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: Row order in matrix filling

    Quote Originally Posted by Charles Pegge
    I lose hours of sleep worrying about how matrices and other arrays are organised in memory
    Me too and still to come ;D
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  7. #7
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732
    To make things clear for newcomers to the forum, the syntax with () has been replaced with square brackets later in 2010 (such a changes are done because we are still in Beta stage).

    Please see newer discussion on the topic here:
    http://www.thinbasic.com/community/s...4409#post84409


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #8
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    How do you guys keep track of this stuff? Got my head spinning

Similar Threads

  1. filling a listview AFTER it's visible on the form
    By martin in forum thinAir General
    Replies: 9
    Last Post: 28-06-2009, 16:37

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •