https://github.com/janverschelde/PHCpack
Raw File
Tip revision: e90f79836eff27ef5ec64e08221c6afecbbcebfe authored by janv@uic.edu on 03 June 2016, 22:44:35 UTC
prepared version 0.4.8 of phcpy
Tip revision: e90f798
write_system.m
function write_system(filename,system)
%
% write_system(filename,system)
%   write a polynomial system to a file.
%
% INPUT:
%   filename   file name
%   system     polynomial system in tableau or cell array format
%              see help solve_system for details
%
formatflag = 0; % default tableau format
if(size(system,2)>1) % system in tableau format
   [sysf,sysf_npoly,sysf_nvar]=make_system(system);
else 
   formatflag = 1; % need to clean file if the system is in cell array format
   sysf_nvar = size(system,1);
   sysf_npoly = sysf_nvar; % for now, assume the system is square
   sysf = system;
end
id = fopen(filename,'wt');
temps = [num2str(sysf_npoly) ' ' num2str(sysf_nvar) '\n']; 
fprintf(id, temps);
clear temps;
for k=1:size(sysf,1)
    fprintf(id, ' ');
    fprintf(id, sysf{k,1});
    fprintf(id, ';\n');
end
fclose(id);
back to top