view mftoolbox/ascent_seq.m @ 8:a587712dcf5f draft default tip

funm_atom.m: rename fun_atom to funm_atom * funm_atom.m: rename fun_atom to funm_atom.
author Antonio Pino Robles <data.script93@gmail.com>
date Fri, 29 May 2015 09:48:36 +0200
parents 8f23314345f4
children
line wrap: on
line source

function [d,a] = ascent_seq(A)
%ASCENT_SEQ   Ascent sequence for square (singular) matrix.
%   [d,a] = ASCENT_SEQ(A) returns symbolically computed
%   a(i) = dim(null(A^(i-1))) and the ascent sequence d = DIFF(a).
%   A has a square root if in the ascent sequence no two terms are
%   the same odd integer.
%   This function is intended for singular matrices of small
%   dimension with exactly known entries.
%   It requires the Symbolic Math Toolbox.

if isempty(ver('symbolic'))
   error('The Symbolic Math Toolbox is required.')
end

n = length(A);
a = zeros(n,1);
A = sym(A);
X = sym(eye(n));
for i = 2:n+1
    X = X*A;
    N = null(X);
    if isempty(N), break, end
    a(i) = rank(N);
end
d = diff(a);