www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DetermineTimetoComputeMatrixSummationExample.m

    %% Determine Time to Compute Matrix Summation  
% Time the combination of several mathematical matrix operations: matrix
% transposition, element-by-element multiplication, and summation of
% columns.
%%  

% Copyright 2015 The MathWorks, Inc.

A = rand(12000,400);
B = rand(400,12000);
f = @() sum(A.'.*B, 1);
timeit(f)