How to perform a vec or vech operation on a matrix.
Subject: How to perform a vec or vech operation on a matrix.
From: Stavros Macrakis
Date: Sun, 12 Apr 2009 15:21:31 -0400
Your code looks correct. Perhaps Var isn't really a 6x6 matrix?
Here's what I get:
Var: genmatrix(lambda([i,j],i+10*j),6,6)$
vecVar:zeromatrix(21,1)$
(k:1, for j:1 thru 6 do (for i:j thru 6 do (vecVar[k,1]:Var[i,j],k:k+1)))$
display2d:false$
vecVar;
matrix([11],[12],[13],[14],[15],[16],[22],[23],[24],[25],[26],[33],[34],[35],[36],[44],
[45],[46],[55],[56],[66])
which looks right to me....
-s
On Tue, Apr 7, 2009 at 11:14 AM, S. McKay Curtis
<smcurtis at stat.washington.edu> wrote:
> Hello,
>
> I am looking for a way to "half-vectorize" a matrix in Maxima. ?I
> couldn't find any "built-in" functions to do this, and my meager
> attempts to write some loops to do this have failed. ?I've tried
>
> vecVar:zeromatrix(21,1);
> k:1;
> for j:1 thru 6 do
> ? ?(for i:j thru 6 do
> ? ? ? ?(vecVar[k,1]:Var[i,j],k:k+1));
>
> where Var is a 6x6 matrix. ?But this gives me an error
>
> No such entry - `setelmx'
> ?-- an error. ?To debug this try debugmode(true);
>
> I get a similar error when I try to use the "setelmx" function directly.
>
> Any help would be appreciated.
>
> Thanks
> McKay
>
> (I am using Maxima through the Windows GUI wxMaxima 0.8.1.)
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>