Wednesday, 20 May 2020

Matrix Utilities: Binary Operators for Complex Matrices

Binary operations on two matrices are implemented in this blog post. The operations include the following (two types of operations for non-commutative operations, a single for commutative ones):

  • Addition : A + B
  • Subtraction : A - B
  • Subtraction : B - A
  • Multiplication : A * B
  • Multiplication : B * A
  • Hadamard product: A .* B
  • Kronecker product: A kron B
  • Kronecker product: B kron A

For the matrix entries in Input A and Input B, comma separated (the separation can also be a single whitespace) Complex numbers need to be entered into the Input boxes, with no newline after the last line. A comma at the end of each line can be added optionally for comma separated numbers. For guidance, the textareas for Input A and Input B have already been populated with example entries.

Note that it is possible to either just transpose the matrices in the textareas for Input A and Input B, or perform a Hermitian tranpose on the matrices in the textareas for Input A and Input B. This is achieved by clicking the relevant buttons. When a Hermitian transpose is performed, the full complex form of the number is displayed.

Alternatively, you can load a CSV file into each of the Input boxes, by clicking on the Choose File button. There is a select drop down menu which allows you to specify into which of the Input boxes (A or B) should the CSV file be loaded. The drop down menu needs to be set appropriately before clicking on the "Chose File" button. The CSV files that need to be loaded into the two boxes must have a different name, even if the contents are the same (due to a limitation of how the CSV loading is implemented).

The precision of the results in decimal places can be specified in the text box headed "Precision (decimal places)".

To perform the calculation, simply press the button labelled "Perform matrix operation" further down this page. Before clicking on this button, you need to specify which binary operation to perform with another select drop down menu. The result will be displayed in the yellow textarea.


Precision (decimal places)






Input A

Input B




A + B



Sunday, 17 May 2020

Matrix Utilities: QR factorisation using Householder reflections for Complex Matrix

This blog post implements the QR factorisation of a square complex matrix, using Householder reflections.

For the (square) matrix entry, comma separated (the separation can also be a single whitespace) numbers need to be entered into the Input box, with no newline after the last line. A comma at the end of each line can be added optionally for comma separated numbers. Alternatively, you can load a CSV file into the Input box, by clicking on the Choose File button.

The precision of the results in decimal places can be specified in the text box headed "Precision (decimal places)". To perform the calculation, simply press the button labelled "Perform QR factorisation" further down this page. Two matrices will be printed in coloured textareas: the Q matrix which is orthogonal, and the upper-triangular R matrix. In addition, intermediate values of the Q and R matrices will be displayed at the bottom.


Precision (decimal places)






Input



Q Matrix

R Matrix


Householder intermediates...



Friday, 15 May 2020

Matrix Utilities: QR factorisation using Gram-Schmidt for Complex Matrix

This blog post implements the QR factorisation of a square matrix whose entries are complex numbers. The Gram-Schmidt method is used to calculate the orthogonal Q matrix.

For the (square) matrix entry, comma separated (the separation can also be a single whitespace) numbers need to be entered into the Input box, with no newline after the last line. You can examine the pre-loaded Input textarea for guidance. A comma at the end of each line can be added optionally for comma separated numbers. Alternatively, you can load a CSV file into the Input box, by clicking on the Choose File button.

The precision of the results in decimal places can be specified in the text box headed "Precision (decimal places)". To perform the calculation, simply press the button labelled "Perform QR factorisation" further down this page. Two matrices will be printed in coloured textareas: the Q matrix which is orthogonal, and the upper-triangular R matrix. In addition, the matrix size and determinant will be printed.


Precision (decimal places)






Input


Results pending...


Q Matrix

R Matrix


Thursday, 14 May 2020

Matrix Utilities: LU factorisarion and Inverse of Complex Matrix

This blog post implements the LU factorisation and inverse calculation of a square matrix with complex numbers. A partial pivot method is used for the LU factorisation. The inverse matrix is calculated from the results of the LU factorisation, using backward and forward substitution.

For the (square) matrix entry, comma separated (the separation can also be a single whitespace) numbers need to be entered into the Input box, with no newline after the last line. A comma at the end of each line can be added optionally for comma separated numbers. Alternatively, you can load a CSV file into the Input box, by clicking on the Choose File button.

The precision of the results in decimal places can be specified in the text box headed "Precision (decimal places)". To perform the calculation, simply press the button labelled "Perform LU factorisation and Inverse" further down this page. Four matrices will be printed in coloured textareas: the Lower Triangular, Upper Triangular, Permutation and Inverse. In addition, the matrix size and determinant will be printed.


Precision (decimal places)






Input


Results pending...


Lower Triangular Matrix

Upper Triangular Matrix

Permutation Matrix

Inverse Matrix

Monday, 11 May 2020

Matrix Utilities: QR factorisation using Householder reflections for Real Matrix

This blog post implements the QR factorisation of a square matrix, using Householder reflections.

For the (square) matrix entry, comma separated (the separation can also be a single whitespace) numbers need to be entered into the Input box, with no newline after the last line. A comma at the end of each line can be added optionally for comma separated numbers. Alternatively, you can load a CSV file into the Input box, by clicking on the Choose File button.

The precision of the results in decimal places can be specified in the text box headed "Precision (decimal places)". To perform the calculation, simply press the button labelled "Perform QR factorisation" further down this page. Two matrices will be printed in coloured textareas: the Q matrix which is orthogonal, and the upper-triangular R matrix. In addition, intermediate values of the Q and R matrices will be displayed at the bottom.


Precision (decimal places)






Input



Q Matrix

R Matrix


Householder intermediates...