UNPKG

1.14 kBJavaScriptView Raw
1'use strict'
2
3function factory (type, config, load, typed) {
4 const transpose = load(require('./transpose'))
5 const conj = load(require('../complex/conj'))
6 const latex = require('../../utils/latex')
7
8 /**
9 * Transpose and complex conjugate a matrix. All values of the matrix are
10 * reflected over its main diagonal and then the complex conjugate is
11 * taken. This is equivalent to complex conjugation for scalars and
12 * vectors.
13 *
14 * Syntax:
15 *
16 * math.ctranspose(x)
17 *
18 * Examples:
19 *
20 * const A = [[1, 2, 3], [4, 5, math.complex(6,7)]]
21 * math.ctranspose(A) // returns [[1, 4], [2, 5], [3, {re:6,im:7}]]
22 *
23 * See also:
24 *
25 * transpose, diag, inv, subset, squeeze
26 *
27 * @param {Array | Matrix} x Matrix to be ctransposed
28 * @return {Array | Matrix} The ctransposed matrix
29 */
30 const ctranspose = typed('ctranspose', {
31
32 'any': function (x) {
33 return conj(transpose(x))
34 }
35 })
36
37 ctranspose.toTex = { 1: `\\left(\${args[0]}\\right)${latex.operators['ctranspose']}` }
38
39 return ctranspose
40}
41
42exports.name = 'ctranspose'
43exports.factory = factory