[Maxima] way to resize a matrix?
macrakis at alum.mit.edu
Tue May 13 09:28:50 CDT 2008
On Tue, May 13, 2008 at 9:21 AM, Andrei Zorine <zoav1602 at gmail.com> wrote:
> What's the canonical way to resize a matrix?
> resize_matrix(m,rows,cols):=block([list: flatten(m), a],
> a[i,j]:= list[j+(i-1)*rows],
Has the definition of flatten on matrices changed in 5.15 to be
equivalent to xreduce(append,args(m))?
If so, then a definition along those lines seems fine, though I think
it's (i-1)*cols -- and by the way block declarations do *not* make
function or matrix definitions local. A somewhat more compact
definition would be
genmatrix( lambda([i,j],list[j+(i-1)*cols]), rows, cols))$
Is this what you had in mind?
More information about the Maxima