Question: How to extract triangular matrix into a vector (column)?

restart:
with(ArrayTools):
m:=<1,2,3,4|3,2,1,0|x,y,z,z0|a,a,a,a|b,b,b,b>;
lscol:=<seq(1-AddAlongDimension(m,2)[i],i=1..4)>;
m:=<m|lscol>;
UpperTriangle(m);

Hi all,

I wonder if there is a way to extract the upper/lower triangle entries from a matrix?

Basically, I want to creat a column vector of the none zero entries in "UpperTriangle(m);"

 

Also, aside, is there a way to quickly assign those entries with some values? Say if I want to make those "UpperTriangle(m);" entries to seq(myvalue[i],i=1..18)?

 

Thanks!!!

Casper

Please Wait...