Skip to content
Snippets Groups Projects
Commit a8c6d8e4 authored by giuliaghirardini's avatar giuliaghirardini
Browse files

[benchmark][speed] Added new operations: dterminant, inverse, \, transpose matrix

parent ca21425d
No related branches found
Tags
No related merge requests found
function determinantTime = determinantSpeed(len)
rng;
x = randi(1000,len,len);
testClass.a = x; testStruct.a = x;
tic
t = det(testStruct.a);
determinantTime.struct = toc;
tic
t = det(testClass.a);
determinantTime.class = toc;
end
\ No newline at end of file
function inverseTime = inverseSpeed(len)
rng;
x = randi(1000,len,len);
testClass.a = x; testStruct.a = x;
tic
t = inv(testStruct.a);
inverseTime.struct = toc;
tic
t = inv(testClass.a);
inverseTime.class = toc;
end
\ No newline at end of file
function mldivideTime = mldivideSpeed(len)
rng;
A = randi(1000,len,len);
B = randi(1000,len,1);
testClass.a = A; testStruct.a = A;
testClass.b = B; testStruct.b = B;
tic
t = mldivide(testStruct.a,testStruct.b);
mldivideTime.struct = toc;
tic
t = mldivide(testClass.a,testClass.b);
mldivideTime.class = toc;
end
\ No newline at end of file
function transposeTime = transposeSpeed(len)
rng;
x = randi(1000,len,len);
testClass.a = x; testStruct.a = x;
tic
t = testStruct.a';
transposeTime.struct = toc;
tic
t = testClass.a';
transposeTime.class = toc;
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment