Matrix transposition: Difference between revisions

Line 1,322:
tranposed = a.'; % tranpose
ctransp = a'; % conjugate transpose</lang>
 
=={{header|OxygenBasic}}==
<lang oxygenbasic>
function Transpose(double *A,*B, sys nx,ny)
'==========================================
sys x,y
indexbase 0
for x=0 to <nx
for y=0 to <ny
B[y*nx+x]=A[x*ny+y]
next
next
end function
 
function MatrixShow(double*A, sys nx,ny) as string
'=================================================
sys x,y
indexbase 0
string pr="",tab=chr(9),cr=chr(13)+chr(10)
for y=0 to <ny
for x=0 to <nx
pr+=tab A[x*ny+y]
next
pr+=cr
next
return pr
end function
 
'====
'DEMO
'====
 
double A[5*4],B[4*5]
'columns x
'rows y
 
A <= 'y minor, x major
11,12,13,14,15,
21,22,23,24,25,
31,32,33,34,35,
41,42,43,44,45
 
print MatrixShow A,5,4
Transpose A,B,5,4
print MatrixShow B,4,5
</lang>
 
=={{header|PARI/GP}}==
Anonymous user