ctranspose.js 1017 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { factory } from '../../utils/factory.js';
  2. var name = 'ctranspose';
  3. var dependencies = ['typed', 'transpose', 'conj'];
  4. export var createCtranspose = /* #__PURE__ */factory(name, dependencies, _ref => {
  5. var {
  6. typed,
  7. transpose,
  8. conj
  9. } = _ref;
  10. /**
  11. * Transpose and complex conjugate a matrix. All values of the matrix are
  12. * reflected over its main diagonal and then the complex conjugate is
  13. * taken. This is equivalent to complex conjugation for scalars and
  14. * vectors.
  15. *
  16. * Syntax:
  17. *
  18. * math.ctranspose(x)
  19. *
  20. * Examples:
  21. *
  22. * const A = [[1, 2, 3], [4, 5, math.complex(6,7)]]
  23. * math.ctranspose(A) // returns [[1, 4], [2, 5], [3, {re:6,im:7}]]
  24. *
  25. * See also:
  26. *
  27. * transpose, diag, inv, subset, squeeze
  28. *
  29. * @param {Array | Matrix} x Matrix to be ctransposed
  30. * @return {Array | Matrix} The ctransposed matrix
  31. */
  32. return typed(name, {
  33. any: function any(x) {
  34. return conj(transpose(x));
  35. }
  36. });
  37. });