Anonymous user
Conjugate transpose: Difference between revisions
m
→{{header|REXX}}: changed whitespace, aligned procedure/function statements
m (→{{header|REXX}}: changed whitespace, used templates for the output sections.) |
m (→{{header|REXX}}: changed whitespace, aligned procedure/function statements) |
||
Line 2,441:
parse arg N elements; if N==''|N=="," then N=3 /*Not specified? Then use the default.*/
k= 0; do r=1 for N
do c=1 for N; k= k+1; M.r.c= word( word(elements, k) 1,
end /*
end /*r*/
call showCmat 'M' ,N /*display a nicely formatted matrix. */
identity.= 0; do d=1 for N; identity.d.d= 1; end /*d*/
Line 2,459 ⟶ 2,460:
rP: procedure; parse arg r ','; return word( r 0, 1) /*◄──maybe return a 0 ↑ */
/*──────────────────────────────────────────────────────────────────────────────────────*/
conjCmat: parse arg matX,matY,rows 1 cols; call normCmat matY, rows
/*──────────────────────────────────────────────────────────────────────────────────────*/
isHermitian: parse arg matX,matY,rows 1 cols; call normCmat matX, rows
call normCmat matY, rows
/*──────────────────────────────────────────────────────────────────────────────────────*/
isUnary: parse arg matX,rows 1 cols
/*──────────────────────────────────────────────────────────────────────────────────────*/
multCmat: parse arg matA,matB,matT,rows 1 cols; call value matT'.', 0
/*──────────────────────────────────────────────────────────────────────────────────────*/
normCmat: parse arg matN,rows 1 cols
/*──────────────────────────────────────────────────────────────────────────────────────*/
showCmat: parse arg matX,rows,cols; if cols=='' then cols= rows; @@= left('', 6)
say; say center('matrix' matX, 79, '─'); call normCmat matX, rows, cols
end
end /*r*/; say; return
/*──────────────────────────────────────────────────────────────────────────────────────*/
sqrt: procedure; parse arg x; if x=0 then return 0; d=digits(); numeric form; h=d+6
|