Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%% case 1
A = 1;
B = 2;
C = mtimesm(A,B);
C_correct = 2;
assert(isequal(C,C_correct))
|
2 | Pass |
%% case 2
A = rand(2,3);
B = rand(3,4);
C = mtimesm(A,B);
C_correct = A*B;
assert(isequal(C,C_correct))
|
3 | Pass |
%% case 3
A = rand(2,3);
B = 2;
C = mtimesm(A,B);
C_correct = 2*A;
assert(isequal(C,C_correct))
|
4 | Pass |
%% case 4
A = rand(2,3,2);
B = rand(3,4,2);
C = mtimesm(A,B);
C_correct = cat(3,A(:,:,1)*B(:,:,1),A(:,:,2)*B(:,:,2));
assert(isequal(C,C_correct))
|
5 | Pass |
%% case 5
A = rand(2,3,3);
B = rand(3,4);
C = mtimesm(A,B);
C_correct = cat(3,A(:,:,1)*B,A(:,:,2)*B,A(:,:,3)*B);
assert(isequal(C,C_correct))
|
6 | Pass |
%% case 6
A = rand(4,3,1,2);
B = rand(3,2,2);
C = mtimesm(A,B);
C_correct(:,:,1,1) = A(:,:,1,1)*B(:,:,1);
C_correct(:,:,1,2) = A(:,:,1,2)*B(:,:,1);
C_correct(:,:,2,1) = A(:,:,1,1)*B(:,:,2);
C_correct(:,:,2,2) = A(:,:,1,2)*B(:,:,2);
assert(isequal(C,C_correct))
|
7 | Pass |
%% case 7
A = rand(4,3,1,2);
B = rand(3,2,1,1,2);
C = mtimesm(A,B);
C_correct(:,:,1,1,1) = A(:,:,1,1)*B(:,:,1,1,1);
C_correct(:,:,1,1,2) = A(:,:,1,1)*B(:,:,1,1,2);
C_correct(:,:,1,2,1) = A(:,:,1,2)*B(:,:,1,1,1);
C_correct(:,:,1,2,2) = A(:,:,1,2)*B(:,:,1,1,2);
assert(isequal(C,C_correct))
|
483 Solvers
17125 Solvers
Back to basics 13 - Input variables
233 Solvers
Replace all zeros and NaNs in a matrix with the string 'error'
90 Solvers
Circular Primes (based on Project Euler, problem 35)
140 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!