[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60515] trace documentation
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #60515] trace documentation |
Date: |
Tue, 4 May 2021 17:27:16 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 |
Follow-up Comment #1, bug #60515 (project octave):
It's generally understood from linear algebra that trace() applies to 2-D
matrices. Matlab also doesn't bother to document that N-dimensional arrays
are excluded.
If you need a trace of a 2-D projection then you will need to use a for loop
as you asked. For example,
A = rand (3,3,3);
T = zeros (3,1);
for i = 1:3
T(i) = trace (A(:,:,i));
endfor
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60515>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/