# Add functions to TMatrix and friends

**URL:** <https://root-forum.cern.ch/t/add-functions-to-tmatrix-and-friends/8163>\
**Category:** Evolution Proposals, Apps & Ideas\
**Created:** [April 8, 2009, 10:21pm UTC](https://root-forum.cern.ch/t/add-functions-to-tmatrix-and-friends/8163 "2009-04-08T22:21:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdbarnes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pdbarnes/32/11190_2.png) [@pdbarnes](https://root-forum.cern.ch/u/pdbarnes)\
**Post date:** [April 8, 2009, 10:21pm UTC](https://root-forum.cern.ch/t/add-functions-to-tmatrix-and-friends/8163/1 "2009-04-08T22:21:09Z")

</div>

Hello Folks,

I needed to do a lot of mixed vector/matrix expressions, such as

`double s = v1 * M * v2; // e.g., physics matrix element
TMatrixD M = v1' * v2 // outer product of v1 and v2
`  
The attached files implement these functions, along with vector/matrix AreCompatible functions.

Enjoy,  
Peter  
[NGMTMatrix.h](https://root-forum.cern.ch/uploads/default/original/2X/c/cd1b3e062118331faed400c83d67dde3556345cd.h) (6.24 KB)  
[NGMTMatrix.cpp](https://root-forum.cern.ch/uploads/default/original/2X/1/17b71e14fbdce6192557f8c87a260b8c37de1dbe.cpp) (1.79 KB)

---

<div class="post-metadata">

**Author:** ![brun](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/b9e5f3/32.png) [@brun](https://root-forum.cern.ch/u/brun)\
**Post date:** [September 14, 2009, 5:14am UTC](https://root-forum.cern.ch/t/add-functions-to-tmatrix-and-friends/8163/2 "2009-09-14T05:14:15Z")

</div>

Hi Peter,

Your extensions to the matrix package are now in the SVN trunk.  
Thanks very much for this interesting contribution and thanks to Eddy Offermann for doing the integration.

Rene
