No BSD License  

Highlights from
Efficient Approximative Multiplication of Square Matrices

from Efficient Approximative Multiplication of Square Matrices by Henrik Pagenkopf
Public math open-source project in Java & MATLAB.

max_differ_mat(A, B) % returns the maximum Euklidian coordinate distance for matrices A and B.
%
% Copyright (C) May/June 2005 by Henrik Pagenkopf
%

function [row, col, dist]= max_differ_mat(A, B) % returns the maximum Euklidian coordinate distance for matrices A and B.
%
% - cond: A and B are square matrices and have same sizes >= 1.
%
  sa = size(A);
  sb = size(B);

  if sa(1) >= 1 && sa(1)== sa(2) && sb(1)== sb(2) && sa(1)== sb(1) % => sa(2)== sb(2)

      s = sa(1);
    max = 0;
     rp = 1; cp = 1; % current row and column position

    for  i = 1 : s
     for k = 1 : s

         m = A(i,k)- B(i,k);

         d = real(m)^2 + imag(m)^2; % non-negative
      if d > max
             max = d;
              rp = i;
              cp = k;
      end % if

     end
    end % for

    dist = max;
    row  = rp ;
    col  = cp ;

  else % error

  end

% return.

Contact us at files@mathworks.com