Menu

#585 Trace command

Backlog
open
nobody
feature (71)
6normal
2024-06-07
2024-06-06
Steve Keen
No

It would be good to be able to extract the Trace from a matrix. One case for it is the attached, where a correlation coefficient has been performed and only the country on country results are required. A Trace command could thus be wired up to the output of the correlation coefficient result and only the country on country results would be returned.

This does raise one issue: how to dimension the output. In this case it would be best to dimension by country, but there may be cases where just the trace is desired. In general I'd go with retaining the relevant dimension.

2 Attachments

Discussion

  • High Performance Coder

    Well technically what you want is a diagonal operator - sort of like eye, but extracting the diagonal of the tensor. Trace is the sum of the diagonal.

    It should be possible to construct this using existing features, but the x-vector makes is difficult. Attached is my solution to the problem.

    Nevertheless, this is probably a useful feature to add, but it is too late in the day for this development cycle.

     
  • High Performance Coder

    Screenshot of the diagonal extraction solution.

     
  • High Performance Coder

    • labels: --> feature
    • Milestone: Pascal --> Backlog
     

Log in to post a comment.