% trnglDef.m % 16 JUne 2004 % from TrikoorinEnglish.m % % Here the compositions by Tex (Swedish painter) are coded. % Each composition consists of three colored triangles. % Each triangle is determined by the x- and y-coordinates for the % leftmost corner and by the angle between a vertical % and the side down to lowest corner. Each coordinate is given by eight % bits. For x and y the resolution will be 0.5 mm. % Angles are determined by seven bits. The resolution will thus be one % degree. % Each triangle is colored red, green or blue. The intensity for each color % is given by two bits. A red triangle thus has the color vector % [1 1 0 0 0 0], a green triangle has the color vctor [0 0 1 1 0 0]. % Each composition thus has 3(8+8+7+6) = 87 bits. % First all coordinates are given as binary numbers. A1t = [0 0 1 0 0 0 1 0 0 0 1 0 0 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1]'; A1 = A1t(:); % to recover original decimal coordinates/data A1d = [pow2(6:-1:-1)*A1t(1:8,:) pow2(6:-1:-1)*A1t((1:8)+8,:) pow2(6:-1:0)*A1t((1:7)+16,:) [2 1]*A1t((1:2)+23,:) [2 1]*A1t((1:2)+25,:) [2 1]*A1t((1:2)+27,:)]' ; % to recreate the binary representation A1b == A1t A1b = [dec2bin(2*A1d(:,1),8) dec2bin(2*A1d(:,2),8) dec2bin(A1d(:,3),7) ... dec2bin(A1d(:,4),2) dec2bin(A1d(:,5),2) dec2bin(A1d(:,6),2)]' - '0' ; A2tri1=[0 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A2tri2=[0 1 0 0 1 1 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 1 1]; A2tri3=[0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A2=[A2tri1 A2tri2 A2tri3]; A2=A2'; A3tri1=[0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A3tri2=[0 0 1 0 1 1 0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 0 0 0 0 0 1 1]; A3tri3=[0 0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A3=[A3tri1 A3tri2 A3tri3]; A3=A3'; A4tri1=[0 0 0 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A4tri2=[0 1 0 1 0 0 0 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A4tri3=[0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 1 1 0 1 1 0 1 0 0 0 0 0 1 1]; A4=[A4tri1 A4tri2 A4tri3]; A4=A4'; A5tri1=[0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A5tri2=[0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A5tri3=[0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1]; A5=[A5tri1 A5tri2 A5tri3]; A5=A5'; % All the coordinates of the A-compositions are stored in a matrix. TA=[A1 A2 A3 A4 A5]; % is 87 x 5 B1t = [0 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 0 0 0 0 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 0 1 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0]' ; B1 = B1t(:) ; % to recover original decimal coordinates/data B1d = [pow2(6:-1:-1)*B1t(1:8,:) pow2(6:-1:-1)*B1t((1:8)+8,:) pow2(6:-1:0)*B1t((1:7)+16,:) [2 1]*B1t((1:2)+23,:) [2 1]*B1t((1:2)+25,:) [2 1]*B1t((1:2)+27,:)]' ; % x y o r g b % 14 77.5 37 3 0 0 % 36.5 55. 101 0 0 3 % 14.5 36.5 43 0 3 0 % to recreate the binary representation B1b == B1t B1b = [dec2bin(2*B1d(:,1),8) dec2bin(2*B1d(:,2),8) dec2bin(B1d(:,3),7) ... dec2bin(B1d(:,4),2) dec2bin(B1d(:,5),2) dec2bin(B1d(:,6),2)]' - '0' ; B2tri1=[0 0 1 1 1 1 1 0 0 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 0 0 0 1 1]; B2tri2=[0 0 0 1 0 1 1 1 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 0 1 1 0 0]; B2tri3=[0 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 0 0 0 0]; B2=[B2tri1 B2tri2 B2tri3]; B2=B2'; B3tri1=[0 1 1 0 1 0 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 0 1 1 0 0]; B3tri2=[0 0 1 0 1 0 0 0 0 0 1 1 1 0 1 0 0 1 0 1 0 0 1 1 1 0 0 0 0]; B3tri3=[0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1]; B3=[B3tri1 B3tri2 B3tri3]; B3=B3'; B4tri1=[0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0]; B4tri2=[0 1 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 1 1 0 0]; B4tri3=[0 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 1]; B4=[B4tri1 B4tri2 B4tri3]; B4=B4'; B5tri1=[0 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0]; B5tri2=[0 0 1 0 1 0 1 0 0 0 1 0 1 1 0 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 0 0 0 1 0 0 1 1 0 0 0 0]; D4=[D4tri1 D4tri2 D4tri3]; D4=D4'; D5tri1=[0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1 1 0 0]; D5tri2=[0 0 1 1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 1 1 1 1 0 0 0 0 0 1 1]; D5tri3=[0 0 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0]; D5=[D5tri1 D5tri2 D5tri3]; D5=D5'; % All the coordinates of the D-compositions are stored in a matrix. TD=[D1 D2 D3 D4 D5]; % Since Hopfield uses -1 instead of 0 we make the exchange: TA = 2*TA - 1; % is 87 by 5 TB = 2*TB - 1; TD = 2*TD - 1; T = [TA TB TD]; % is 87 by 15 % Now we add noisy versions of D. rand('seed',sum(100*clock)) TBRUS1 = T ; prt = [8 16 23 37 45 52 66 74 81]; TBRUS1(prt, :) = sign(rands(size(prt,2), 15)) ; TBRUS2=[T(1:6,:) sign(rands(2,15)) T(9:14,:) sign(rands(2,15)) T(17:21,:) sign(rands(2,15)) T(24:29,:) T(30:35,:) sign(rands(2,15)) T(38:43,:) sign(rands(2,15)) T(46:50,:) sign(rands(2,15)) T(53:58,:) T(59:64,:) sign(rands(2,15)) T(67:72,:) sign(rands(2,15)) T(75:79,:) sign(rands(2,15)) T(82:87,:)]; TBRUS3=[T(1:5,:) sign(rands(3,15)) T(9:13,:) sign(rands(3,15)) T(17:20,:) sign(rands(3,15)) T(24:29,:) T(30:34,:) sign(rands(3,15)) T(38:42,:) sign(rands(3,15)) T(46:49,:) sign(rands(3,15)) T(53:58,:) T(59:63,:) sign(rands(3,15)) T(67:71,:) sign(rands(3,15)) T(75:78,:) sign(rands(3,15)) T(82:87,:)]; TBRUS4=[T(1:4,:) sign(rands(4,15)) T(9:12,:) sign(rands(4,15)) T(17:19,:) sign(rands(4,15)) T(24:29,:) T(30:33,:) sign(rands(4,15)) T(38:41,:) sign(rands(4,15)) T(46:48,:) sign(rands(4,15)) T(53:58,:) T(59:62,:) sign(rands(4,15)) T(67:70,:) sign(rands(4,15)) T(75:77,:) sign(rands(4,15)) T(82:87,:)]; TBRUS5=[T(1:3,:) sign(rands(5,15)) T(9:11,:) sign(rands(5,15)) T(17:18,:) sign(rands(5,15)) T(24:29,:) T(30:32,:) sign(rands(5,15)) T(38:40,:) sign(rands(5,15)) T(46:47,:) sign(rands(5,15)) T(53:58,:) T(59:61,:) sign(rands(5,15)) T(67:69,:) sign(rands(5,15)) T(75:76,:) sign(rands(5,15)) T(82:87,:)]; TBRUS6=[T(1:2,:) sign(rands(6,15)) T(9:10,:) sign(rands(6,15)) T(17,:) sign(rands(6,15)) sign(rands(6,15)) T(30:31,:) sign(rands(6,15)) T(38:39,:) sign(rands(6,15)) T(46,:) sign(rands(6,15)) sign(rands(6,15)) T(59:60,:) sign(rands(6,15)) T(67:68,:) sign(rands(6,15)) T(75,:) sign(rands(6,15)) sign(rands(6,15))];