Cody

# Problem 459. Sum of diagonal of a square matrix

Solution 1943106

Submitted on 19 Sep 2019 by Eugene Kronberg
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))

ans = 34

2   Pass
x = ones(5); y_correct = sum(diag(x)); assert(isequal(your_fcn_name(x),y_correct))

ans = 5
{"ft_lang_label":"__label__en","ft_lang_prob":0.66974694,"math_prob":0.9918008,"size":485,"snap":"2020-34-2020-40","text_gpt3_token_len":140,"char_repetition_ratio":0.13513513,"word_repetition_ratio":0.056338027,"special_character_ratio":0.31340206,"punctuation_ratio":0.1,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9957009,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-13T06:29:02Z\",\"WARC-Record-ID\":\"<urn:uuid:1cd4499a-89bd-4197-91ac-70e194a1b552>\",\"Content-Length\":\"71763\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3df90628-c679-4322-a0f7-6621589acb51>\",\"WARC-Concurrent-To\":\"<urn:uuid:c8a76729-6b56-4e1e-be95-11e859714ba7>\",\"WARC-IP-Address\":\"23.66.56.59\",\"WARC-Target-URI\":\"https://it.mathworks.com/matlabcentral/cody/problems/459-sum-of-diagonal-of-a-square-matrix/solutions/1943106\",\"WARC-Payload-Digest\":\"sha1:2XCMR5SBQD7SCPMGSJENDLJ4HPQOJ326\",\"WARC-Block-Digest\":\"sha1:DQ24RIPPJPKORNAH3RUBQX7LUXVBFIER\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439738960.69_warc_CC-MAIN-20200813043927-20200813073927-00525.warc.gz\"}"}