Cody

# Problem 459. Sum of diagonal of a square matrix

Solution 62350

Submitted on 17 Mar 2012 by Guillaume LaHaye
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   Pass
%% x = magic(4); y_correct = sum(diag(x)); assert(isequal(your_fcn_name(x),y_correct))

2   Pass
%% x = ones(5); y_correct = sum(diag(x)); assert(isequal(your_fcn_name(x),y_correct))
{"ft_lang_label":"__label__en","ft_lang_prob":0.68558145,"math_prob":0.9887312,"size":495,"snap":"2020-24-2020-29","text_gpt3_token_len":142,"char_repetition_ratio":0.14052953,"word_repetition_ratio":0.028571429,"special_character_ratio":0.3151515,"punctuation_ratio":0.12087912,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99121696,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-07-16T17:57:38Z\",\"WARC-Record-ID\":\"<urn:uuid:b723ace3-984c-49ff-8777-5f3ca42ad7cf>\",\"Content-Length\":\"71905\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:70682967-bd4b-419f-8684-4adf6aa03c49>\",\"WARC-Concurrent-To\":\"<urn:uuid:dae9f041-c726-48a0-a036-f86f92884260>\",\"WARC-IP-Address\":\"23.66.56.59\",\"WARC-Target-URI\":\"https://fr.mathworks.com/matlabcentral/cody/problems/459-sum-of-diagonal-of-a-square-matrix/solutions/62350\",\"WARC-Payload-Digest\":\"sha1:FQSOEXQC3FGH4RLGQ23UQVYAQBO66XKV\",\"WARC-Block-Digest\":\"sha1:BHAYW4LFS6KDFJ5DSA574LAKQDV2DXSH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-29/CC-MAIN-2020-29_segments_1593657172545.84_warc_CC-MAIN-20200716153247-20200716183247-00222.warc.gz\"}"}