Skip to content

Modern Math Transpose

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Math Library › Math Library › Transpose

Transpose

Returns a matrix with its rows and columns swapped.

Syntax

Transpose( byref a as Mat4 ) as Mat4

Notes

  • For a rotation matrix the transpose is the inverse, which is why a view matrix can be built without inverting anything.
  • The storage is column-major -- m( column * 4 + row ) -- so transposing is also the conversion to and from a row-major API.
  • Its own inverse.

Examples

#import "std/numeric"
using numeric

dim as Mat4 m
for i as int32 = 0 to 15
    m.m( i ) = i
next

dim as Mat4 t = Transpose( m )
print t.m( 1 )               '' 4 -- row and column exchanged

'' Its own inverse
print Transpose( t ).m( 1 )  '' 1

Library: Math Library
Category: Math Library
Documented under: Members

Clone this wiki locally