comparison mftoolbox/ascent_seq.m @ 0:8f23314345f4 draft

Create local repository for matrix toolboxes. Step #0 done.
author Antonio Pino Robles <data.script93@gmail.com>
date Wed, 06 May 2015 14:56:53 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8f23314345f4
1 function [d,a] = ascent_seq(A)
2 %ASCENT_SEQ Ascent sequence for square (singular) matrix.
3 % [d,a] = ASCENT_SEQ(A) returns symbolically computed
4 % a(i) = dim(null(A^(i-1))) and the ascent sequence d = DIFF(a).
5 % A has a square root if in the ascent sequence no two terms are
6 % the same odd integer.
7 % This function is intended for singular matrices of small
8 % dimension with exactly known entries.
9 % It requires the Symbolic Math Toolbox.
10
11 if isempty(ver('symbolic'))
12 error('The Symbolic Math Toolbox is required.')
13 end
14
15 n = length(A);
16 a = zeros(n,1);
17 A = sym(A);
18 X = sym(eye(n));
19 for i = 2:n+1
20 X = X*A;
21 N = null(X);
22 if isempty(N), break, end
23 a(i) = rank(N);
24 end
25 d = diff(a);