function [C]=strassen(A,B,n);
if n==1, C=A*B; else
  m=n/2; 
  A11=A(1:m,1:m); A12=A(1:m,m+1:n); A21=A(m+1:n,1:m); A22=A(m+1:n,m+1:n);
  B11=B(1:m,1:m); B12=B(1:m,m+1:n); B21=B(m+1:n,1:m); B22=B(m+1:n,m+1:n);
  P1=strassen(A12-A22,B21+B22,m); P2=strassen(A11+A22,B11+B22,m);
  P3=strassen(A11-A21,B11+B12,m); P4=strassen(A11+A12,B22,m);
  P5=strassen(A11,B12-B22,m);     P6=strassen(A22,B21-B11,m);
  P7=strassen(A21+A22,B11,m);     C11=P1+P2-P4+P6;C12=P4+P5;C21=P6+P7;
  C22=P2-P3+P5-P7;                  C=[C11 C12;C21 C22];
end; %if
