1
function [U, S, V] = kbisnf(A)
3
% [U, S, V] = kbisnf(A)
5
% Computes the integer Smith normal form S such that
9
% Uses external Kannan-Bachem implementation
11
% Copyright (C) 4.11.2003 Saku Suuriniemi TUT/CEM
13
% This program is free software; you can redistribute it and/or modify
14
% it under the terms of the GNU General Public License as published by
15
% the Free Software Foundation; either version 2 of the License, or
18
% This program is distributed in the hope that it will be useful,
19
% but WITHOUT ANY WARRANTY; without even the implied warranty of
20
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
% GNU General Public License for more details.
23
% You should have received a copy of the GNU General Public License
24
% along with this program; if not, write to the Free Software
25
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
% Saku Suuriniemi, TUT/Electromagetics
28
% P.O.Box 692, FIN-33101 Tampere, Finland
29
% saku.suuriniemi@tut.fi
33
fid = fopen('snf_temp.crd', 'w');
34
fprintf(fid, '%g %g %g\n', size(A,1), size(A,2), length(i));
36
fprintf(fid, '%g %g %g\n', [i'; j'; v']);
40
system ('./compute_normal_form -S snf_temp.crd');
43
U = zeros(snf_temp(1,1), snf_temp(1,2));
44
for i = 2:size(snf_temp,1)
45
U(snf_temp(i,1), snf_temp(i,2)) = snf_temp(i,3);
49
S = zeros(snf_temp(1,1), snf_temp(1,2));
50
for i = 2:size(snf_temp,1)
51
S(snf_temp(i,1), snf_temp(i,2)) = snf_temp(i,3);
55
V = zeros(snf_temp(1,1), snf_temp(1,2));
56
for i = 2:size(snf_temp,1)
57
V(snf_temp(i,1), snf_temp(i,2)) = snf_temp(i,3);