Cody

Problem 43027. Upper Matrix in LU Decompositon

Solution 1025810

Submitted on 21 Oct 2016
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
filetext = fileread('UpperMat.m'); assert(isempty(strfind(filetext, 'triu')),'triu() forbidden')

Error using fileread (line 23) Could not open file UpperMat.m. No such file or directory. Error in Test1 (line 1) filetext = fileread('UpperMat.m');

2   Fail
x = [2 4 -2; 4 -2 6; 6 -4 2] ; y_correct = [2 4 -2; 0 -10 10; 0 0 -8]; assert(isequal(UpperMat(x),y_correct))

Undefined function 'UpperMat' for input arguments of type 'double'. Error in Test2 (line 3) assert(isequal(UpperMat(x),y_correct))

3   Fail
x = [15 7 5; 2 4 6; 0 9 10] ; y_correct = [15 7 5; 0 46/15 16/3; 0 0 -130/23]; assert(abs(sum(sum(UpperMat(x)-y_correct)))<0.01)

Undefined function 'UpperMat' for input arguments of type 'double'. Error in Test3 (line 3) assert(abs(sum(sum(UpperMat(x)-y_correct)))<0.01)