Question: getting sum of all elements in a Matrix

Hi all,

I am trying to get the following matrix:

restart:
int00:=Matrix(3,3);
int00[2,2]:=a;
int00[2,3]:=b;
int00[3,2]:=c;
int00[3,3]:=d;
int00;
cols:=MTM:-sum(int00,1);
rows:=MTM:-sum(int00,2);
int00[1,1..3]:=-cols:
int00[1..3,1]:=-rows:
int00;

int00[1,1]:=a+b+c+d:
int00;
MTM:-sum(int00,1);
MTM:-sum(int00,2);

How do I get the sum of all elemnets in the 'original' matrix? Bascially, the int00[1,1] term in the toy example.

What's the most efficient way do creat such m by n matrix?

Many thanks,

Casper

Please Wait...