Contents

%mat_generate.m
%
%Generates arbitrary group elements using generating matrices or already
%calculated group elements. For the use of generating matrices only enter
%their corresponding number, selfcreated group elements
%can be loaded via their (self-)given names. created group elements can be
%given a name and saved
%
%input:  nr1,nr2 ... # or name of the two matrices to be multiplied
%        sav     ... Name of generated group element to be saved
%output: C       ... generated group element
%
%Valentin Zauner
%
%05.2008

close all;
clear all;
clc;

rep = 1;
while rep

choose generating matrices

clear nr1 nr2 sav M1 M2;

nr1 = input('1st matrix: ','s');
nr2 = input('2nd matrix: ','s');
disp(' ');

if isempty(nr1)
    %use generated element from last loop if input is empty
    if exist('C','var')
        M1 = C;
        nam1 = 'C';
    else
        M1 = eye(3);
        nam1 = 'E';
    end;
elseif ~isempty(str2num(nr1));
    %if only a number is entered the corresponding generating matrix will
    %be loaded
    nam1 = ['M',nr1];
    t = struct2cell(load(nam1));
    M1 = t{1};
else
    t = struct2cell(load(nr1));
    M1 = t{1};
    nam1 = nr1;
end;

if isempty(nr2)
    %use generated element from last loop if input is empty
    if exist('C','var')
        M2 = C;
        nam2 = 'C';
    else
        M2 = eye(3);
        nam2 = 'E';
    end;
elseif ~isempty(str2num(nr2));
    %if only a number is entered the corresponding generating matrix will
    %be loaded
    nam2 = ['M',nr2];
    t = struct2cell(load(nam2));
    M2 = t{1};
else
    t = struct2cell(load(nr2));
    M2 = t{1};
    nam2 = nr2;
end;

generate and save group element

C = M1*M2;
disp([nam1,'*',nam2,' =']);
disp(C);

sav = input('Save as: ','s');
if ~isempty(sav)%don't save if nothing is entered for 'sav'
    save(sav,'C');
end;

rep = input('wiederholen (default = 1):');
    if isempty(rep),rep=1;end;
end;