% This example is to show how to perform semi-tensor product

x = [1 2 3 -1];
y = [2 1]';
r1 = sp(x,y)
% r1 = [5, 3]

x = [2 1];
y = [1 2 3 -1]';
r2 = sp(x,y)
% r2 = [5; 3]

x = [1 2 1 1; 
     2 3 1 2;
     3 2 1 0];
y = [1 -2;
     2 -1];
r3 = sp(x,y)
r4 = sp1(x,y)
% r3 = r4 = [3,4,-3,-5;4,7,-5,-8;5,2,-7,-4]

r5 = sp(sp(x,y),y)
r6 = spn(x,y,y)
% r5 = r6 = [-3,-6,-3,-3;-6,-9,-3,-6;-9,-6,-3,0]