bugGNU Octave - Bugs: bug #60515, trace documentation

 
 

bug #60515: trace documentation

Submitter:  None
Submitted:  Tue 04 May 2021 08:39:44 AM UTC
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Documentation
Status:  Invalid Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 6.2.0
Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Mon 30 Aug 2021 08:42:48 AM UTC, comment #3: 

No further comments, closing report.

Kai Torben Ohlhus <siko1056>
Project Member
Fri 20 Aug 2021 06:39:47 PM UTC, comment #2: 

Is there anything to fix here?

John W. Eaton <jwe>
Project Administrator
Tue 04 May 2021 09:27:16 PM UTC, comment #1: 

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

Rik <rik5>
Project Administrator
Tue 04 May 2021 08:39:44 AM UTC, original submission:  

A=rand(3,3,3);
x=trace(A)
error: trace: only valid on 2-D objects
error: called from
    trace at line 37 column 5

Expected x to consist of 3 values.

The documentation is not clear about this:

## -*- texinfo -*-
## @deftypefn {} {} trace (@var{A})
## Compute the trace of @var{A}, the sum of the elements along the main
## diagonal.
##
## The implementation is straightforward: @code{sum (diag (@var{A}))}.
## @seealso{eig}
## @end deftypefn

The error is more clear.

---------------------------

Having many DCM and doing the trace.
Does this need to done in a loop?

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-30 siko1056 StatusNone Invalid
        Open/ClosedOpen Closed
    2021-08-20 jwe CategoryNone Octave Function

    Back to the top


    Powered by Savane 3.9