Matrix transposition: Difference between revisions

Content added Content deleted
(+Stata)
Line 3,085: Line 3,085:


=={{header|Stata}}==
=={{header|Stata}}==
Stata matrices are always real, so there is no ambiguity about the transpose operator. Mata matrices, however, may be real or complex. The transpose operator is actually a conjugate transpose, but there is also a '''[https://www.stata.com/help.cgi?mf_transposeonly transposeonly()]''' function.

=== Stata matrices ===
=== Stata matrices ===
<lang stata>. mat a=1,2,3\4,5,6
<lang stata>. mat a=1,2,3\4,5,6
Line 3,104: Line 3,106:


=== Mata ===
=== Mata ===
<lang stata>: a=1,2,3\4,5,6
<lang stata>: a=1,1i

: a
: a
1 2 3
1 2
+-------------+
+-----------+
1 | 1 2 3 |
1 | 1 1i |
2 | 4 5 6 |
+-----------+
+-------------+


: a'
: a'
1 2
1
+---------+
+-------+
1 | 1 4 |
1 | 1 |
2 | 2 5 |
2 | -1i |
3 | 3 6 |
+-------+

+---------+</lang>
: transposeonly(a)
1
+------+
1 | 1 |
2 | 1i |
+------+</lang>

=={{header|Tcl}}==
=={{header|Tcl}}==
With core Tcl, representing a matrix as a list of lists:
With core Tcl, representing a matrix as a list of lists: