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



Logistic Regression Calculator and ROC Curve Plotter

This blog post implements a Logistic Regression calculator for a binary output. Consider a binary outcome response variable \(Y\...