How to use the ctranspose function from mathjs
Find comprehensive JavaScript mathjs.ctranspose code examples handpicked from public code repositorys.
mathjs.ctranspose is a function in the Math.js library that calculates the complex conjugate transpose of a matrix.
3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113
return this.isIdentityMatrix(math.multiply(U, math.ctranspose(U)), precision); }; QuantumCircuit.prototype.isHermitianMatrix = function(H, precision) { var diff = this.matrixDiff(H, math.ctranspose(H)) return diff <= math.pow(10, -1 * (precision || 14)); };
+ 315 other calls in file
How does mathjs.ctranspose work?
mathjs.ctranspose
is a function in the math.js library that computes the conjugate transpose of a complex matrix, i.e., the complex conjugate of the matrix elements are transposed. It returns a new matrix with the same dimensions as the input matrix. The conjugate transpose of a complex matrix is also called the Hermitian transpose or adjoint.
Ai Example
1 2 3 4 5 6 7 8 9
const math = require("mathjs"); const matrix = math.complex([ [1, 2], [3, 4], ]); const conjugateTranspose = math.ctranspose(matrix); console.log(conjugateTranspose); // => [[1, -3], [2, -4]]
In this example, math.complex creates a complex matrix from a nested array of real numbers, and math.ctranspose computes the conjugate transpose of the matrix. The resulting conjugate transpose is also a complex matrix.
mathjs.evaluate is the most popular function in mathjs (87200 examples)