The input is always a sparse matrix :
x = sparse(100,1000,0.01);
shows that 4016 bytes ares required .
The aim is to find the the number of bytes required to store a sparse matrix without using whos or who commands.
Test Suite case 4 is a Diagonal Sparse matrix which is not a problem defined Sparse matrix and should be replaced by x = sparse(1000,100,0.01);
y_correct = 4016;.
Also, your inventive cheat detect needs to add assert(isempty(strfind(filetext, 'who'))). A re-scoring will see a new leader.
Currently Tests 4 and 5 are always pass as they lack asserts.
Enjoying the challenge.
yup, definitely need some asserts
@Richard, Thanks for your comments. I have added the assert with who and rescored all solutions.
This problem here only focused on real sparse matrix in a 32-bit system. For real sparse matrix in a 64-bit system, we should replace 4 by 8 and 12 by 16 in the calculation. For complex sparse matrix in a 64-bit system, we should replace 4 by 8 and 12 by 24.
Wrong solution(passed due to lack of asserts in tests)
yay research! i found a paper!
whoops, this solution is a fluke. lol, guess i should have trusted the paper more.
Is my wife right?
Sum all integers from 1 to 2^n
Who knows the last digit of pi?
letter yes yes & letter no no
Vectorizing, too easy or too hard?
Make a logical diamond using GALLERY function
Find all the zeros of sinus , cosinus and tangent in a given interval
Set some matrix elements to zero
Assign numerical values to a structure with 1 field
Generate a string like abbcccddddeeeee
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office