.Modelica_LinearSystems2.WorkInProgress.Math.Matrices.C_nullspace

Information

Syntax

           Z = Matrices.nullspace(A);
                 or
(Z, nullity) = Matrices.nullspace(A);

Description

This function calculates a orthonormal basis Z=[z_1, z_2, ...] of the nullspace of a matrix A, i.e. A*z_i=0.

The nullspace is obtained by svd method. That is, matrix A is dcomposed into the matrices S, U, V:

A = USVH

with the orthonormal matrices U and V and the matrix S with

S = [S1, 0]
S1 = [diag(s); 0]

with the singular values s={s1, s2, ..., sr} of A and r=rank(A). Note, that S has the same size as A. Since, U and V are orthonormal, we may write

 UH*A*V = [S1, 0].

Matrix S1 obviously has full column rank and therefore, the left n-r rows (n is the number of columns of A or S) of matrix V span a nullspace of A.

The nullity of matrix A is the dimension of the nullspace of A. In view of the above, it becomes clear that nullity holds

nullity = n - r

with

n = number of columns of matrix A
r = rank(A)

Example

A = [1, 2,  3, 1;
     3, 4,  5, 2;
    -1, 2, -3, 3];
(Z, nullity) = nullspace(A);

// Z = [ 0.1715;
//      -0.686;
//       0.1715;
//       0.686]
// 
// nullity = 1

See also

Matrices.singularValues

Interface

function C_nullspace
  extends Modelica.Icons.Function;
  import Complex;
  import Modelica_LinearSystems2;
  input Complex A[:, :] "input matrix";
  output Complex Z[size(A, 2), :] "orthonormal nullspace of matrix A";
  output Integer nullity "nullity, i.e. the dimension of the nullspace";
end C_nullspace;

Generated at 2025-01-04T19:25:54Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos