2 Some utilities for working with vectors.
4 Copyright (C) Nov. 2008 Volker van Nek
6 For examples see vector_rebuild.usg .
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 eval_when([translate,batch,demo,load], load("vector_rebuild.lisp"))$
26 eval_when([batch,demo,load], ttyoff:true)$
33 /* dotexptsimp: false avoids the following (same for matrices):
34 (%i1) (listarith: false, x: [1,2].[1,2], listarith: true, ev(x));
38 domxplus: false$ /* default */
39 scalarmatrixp: true$ /* default */
40 mx0simp: true$ /* default, if false then 0*matrix([1,2]); --> 0 */
42 /* 1. define mtimesq (vector_rebuild.lisp)
43 2. set listarith & friends
44 3. then we are ready for tellsimpafter
48 is( listp(x) or matrixp(x) or is(equal(abs(x),1))=true )$
50 nlsmx, lambda([x], not lsmx_or_abs1_p(x)),
52 lsmx, lambda([x],listp(x) or matrixp(x)) )$
56 buildq([nlm:nlsmx, tq1:args(tmsq)[1], tq2:args(tmsq)[2]],
57 nlm*tq1 ?mtimesq tq2) )$
59 nlsmx*lsmx, buildq([nlm:nlsmx, lm:lsmx], nlm ?mtimesq lm) )$
61 (-1)*nlsmx*lsmx, buildq([nlm:nlsmx, lm:lsmx], - nlm ?mtimesq lm) )$
63 (-1)*lsmx, buildq([lm:lsmx], - lm) )$
67 /* 2 lines copied from share/matrix/eigen.mac: */
68 columnvector(x):=transpose(matrix(x))$
69 covect(x):=columnvector(x)$
71 eval_when([batch,demo,load], ttyoff:false)$