From 0fbc4ddc784c75b8d1b9b36563304ea09aaac51f Mon Sep 17 00:00:00 2001
From: Sergio Siccha
Date: Wed, 12 Sep 2018 14:45:49 +0200
Subject: [PATCH 1/2] MatrixObj: Doc, Code and Tests for MultRowVector
- Split MultRowVector to MultRowVectorLeft / MultRowVectorRight.
- MultRowVector is declared a synonym for MultRowVectorLeft.
- MultRowVectorOp is renamed to MultRowVectorLeftOp on the C level.
- Add four argument declarations for MultRowVectorLeft( vec, mul, from, to )
and ..Right
- Remove the five argument version of MultRowVector in MatrixObj.
Deprecate it also in the library. This version was not used anywhere in
the library or packages
- Add generic and plist implementations of MultRowVector where necessary
- Implement and declare ..Left and ..Right versions in matrixobj*
- Only do the ..Left version in listcoef.g?. The methods from listcoef.gi
are only used for integers and FFEs in the library.
Adding the ..Right versions would only introduce lots of unused code.
People wanting to use the ..Right versions should use vector objs.
- Have a kernel function MULT_ROW_VECTOR_LEFT_RIGHT_2 which is called by
MULT_ROW_VECTOR_LEFT_2 and ..RIGHT_2
- Add tests for MultRowVector
---
doc/ref/obsolete.xml | 9 +++++
lib/listcoef.gd | 25 ++++++------
lib/listcoef.gi | 73 ++++++++++------------------------
lib/matobj.gi | 45 +++++++++++++++++++++
lib/matobj2.gd | 59 ++++++++++++++++++---------
lib/matobjplist.gi | 29 +++++++-------
lib/obsolete.gd | 27 +++++++++++++
lib/obsolete.gi | 26 +++++++++++-
src/listoper.c | 61 ++++++++++++++++++----------
src/vecffe.c | 4 +-
tst/test-matobj/MultVector.tst | 45 +++++++++++++++++++++
11 files changed, 280 insertions(+), 123 deletions(-)
create mode 100644 tst/test-matobj/MultVector.tst
diff --git a/doc/ref/obsolete.xml b/doc/ref/obsolete.xml
index 7a10f02ce0..b5a776eb33 100644
--- a/doc/ref/obsolete.xml
+++ b/doc/ref/obsolete.xml
@@ -174,6 +174,10 @@ Here are some further name changes.
- MutableNullMat
+
+ - MultRowVector
+
+
@@ -185,6 +189,11 @@ Instead of PositionFirstComponent(list,obj), you may use
PositionProperty(list,x->x[1]=obj) as a replacement, depending on
your specific use case.
+MultRowVector
+The five argument version of the operation MultRowVector has been
+deprecated in GAP 4.10 since it was unused and only available for coefficient
+lists.
+Note that MultRowVector was also renamed to MultVectorLeft.
diff --git a/lib/listcoef.gd b/lib/listcoef.gd
index 8188b21262..a895d7f5e1 100644
--- a/lib/listcoef.gd
+++ b/lib/listcoef.gd
@@ -97,30 +97,29 @@ DeclareOperation(
#############################################################################
##
-#O MultRowVector( , , , , )
-#O MultRowVector( , )
+#O MultRowVectorLeft( , )
##
## <#GAPDoc Label="MultRowVector">
##
-##
+##
+##
+## nothing
##
##
-## The five argument version of this operation replaces
-## list1[poss1[i]] by
-## mul*list2[poss2[i]] for i
-## between 1 and Length( poss1 ).
+## This operation calculates mul*list1 in-place.
##
-## The two-argument version simply multiplies each element of list1,
-## in-place, by mul.
+## Note that MultRowVector is just a synonym for
+## MultRowVectorLeft.
##
##
## <#/GAPDoc>
##
DeclareOperation(
- "MultRowVector",
- [ IsMutable and IsList,
- IsList, IsList, IsList, IsMultiplicativeElement ] );
-
+ "MultRowVectorLeft",
+ [ IsMutable and IsList,
+ IsObject ] );
+# For VectorObj objects there also exists a MultRowVectorRight operation
+DeclareSynonym( "MultRowVector", MultRowVectorLeft );
#############################################################################
##
diff --git a/lib/listcoef.gi b/lib/listcoef.gi
index 1e1d620afa..6c7f2602bb 100644
--- a/lib/listcoef.gi
+++ b/lib/listcoef.gi
@@ -262,73 +262,44 @@ end );
#############################################################################
##
-#M MultRowVector( , , , , )
+#M MultRowVectorLeft( , )
##
-InstallMethod( MultRowVector,"generic method",
- true,
- [ IsDenseList and IsMutable,
- IsDenseList,
- IsDenseList,
- IsDenseList,
- IsMultiplicativeElement ],
- 0,
-
-function( l1, p1, l2, p2, m )
- l1{p1} := m * l2{p2};
-end );
-
-InstallOtherMethod( MultRowVector,"error if immutable",true,
- [ IsList,IsObject,IsObject,IsObject,IsObject],0,
- L1_IMMUTABLE_ERROR);
-
-#############################################################################
-##
-#M MultRowVector( , )
-##
-InstallOtherMethod( MultRowVector,
- "two argument generic method",
- true,
+InstallMethod( MultRowVectorLeft,
+ "for a mutable dense list, and an object",
[ IsDenseList and IsMutable,
- IsMultiplicativeElement ],
- 0,
-
+ IsObject ],
function( l, m )
local i;
-
for i in [ 1 .. Length(l) ] do
l[i] := m * l[i];
od;
end );
-
-InstallOtherMethod( MultRowVector,"error if immutable",true,
- [ IsList,IsObject],0,
+InstallOtherMethod( MultRowVectorLeft, "error if immutable",
+ [ IsList, IsObject ],
L1_IMMUTABLE_ERROR);
-InstallOtherMethod( MultRowVector,
- "Two argument kernel method for small list",
+InstallMethod( MultRowVectorLeft,
+ "kernel method for a mutable dense small list, and an object",
IsCollsElms,
[ IsSmallList and IsDenseList and IsMutable,
- IsMultiplicativeElement ],
- 0,
- MULT_ROW_VECTOR_2
+ IsObject ],
+ MULT_ROW_VECTOR_LEFT_2
);
-
-InstallOtherMethod( MultRowVector,
- "Two argument kernel method for plain list of cyclotomics and an integer",
+InstallMethod( MultRowVectorLeft,
+ "kernel method for a mutable dense plain list of \
+cyclotomics, and a cyclotomic",
IsCollsElms,
- [ IsSmallList and IsDenseList and IsMutable and IsPlistRep and
- IsCyclotomicCollection,
+ [ IsDenseList and IsMutable and IsPlistRep and IsCyclotomicCollection,
IsCyclotomic ],
- 0,
- MULT_ROW_VECTOR_2_FAST
+ MULT_ROW_VECTOR_2_FAST
);
-
-InstallOtherMethod( MultRowVector,
- "kernel method for vecffe (2 args)",
- IsCollsElms,
- [ IsRowVector and IsMutable and IsPlistRep and IsFFECollection,
- IsFFE],0,
- MULT_ROWVECTOR_VECFFES );
+InstallMethod( MultRowVectorLeft,
+ "kernel method for a mutable row vector of ffes in \
+plain list rep, and an ffe",
+ IsCollsElms,
+ [ IsRowVector and IsMutable and IsPlistRep and IsFFECollection,
+ IsFFE],0,
+ MULT_ROWVECTOR_VECFFES );
#############################################################################
diff --git a/lib/matobj.gi b/lib/matobj.gi
index 1018fc1154..f6c765b6a8 100644
--- a/lib/matobj.gi
+++ b/lib/matobj.gi
@@ -586,6 +586,51 @@ InstallMethod( Randomize,
od;
end );
+############################################################################
+# Arithmetical operations:
+############################################################################
+InstallMethod( MultRowVectorLeft,
+ "generic method for a mutable vector, and an object",
+ [ IsVectorObj and IsMutable, IsObject ],
+ function( v, s )
+ local i;
+ for i in [1 .. Length(v)] do
+ v[i] := s * v[i];
+ od;
+ end );
+
+InstallMethod( MultRowVectorRight,
+ "generic method for a mutable vector, and an object",
+ [ IsVectorObj and IsMutable, IsObject ],
+ function( v, s )
+ local i;
+ for i in [1 .. Length(v)] do
+ v[i] := v[i] * s;
+ od;
+ end );
+
+InstallMethod( MultRowVectorLeft,
+ "generic method for a mutable vector, an object, an int, \
+and an int",
+ [ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ],
+ function( v, s, from, to )
+ local i;
+ for i in [from .. to] do
+ v[i] := s * v[i];
+ od;
+ end );
+
+InstallMethod( MultRowVectorRight,
+ "generic method for a mutable vector, an object, an int, \
+and an int",
+ [ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ],
+ function( v, s, from, to )
+ local i;
+ for i in [from .. to] do
+ v[i] := v[i] * s;
+ od;
+ end );
+
#
# Compatibility code: Install MatrixObj methods for IsMatrix.
#
diff --git a/lib/matobj2.gd b/lib/matobj2.gd
index 62f3c0dcc3..d4e472191f 100644
--- a/lib/matobj2.gd
+++ b/lib/matobj2.gd
@@ -382,25 +382,48 @@ DeclareOperation( "AddRowVector",
-# TODO: rename MultRowVector to MultVector; but keep in mind that
-# historically there already was MultRowVector, so be careful to not break that
-DeclareOperation( "MultRowVector",
+#############################################################################
+##
+#O MultRowVector( , [, , ] )
+#O MultRowVectorLeft( , [, , ] )
+#O MultRowVectorRight( , [, , ] )
+##
+## <#GAPDoc Label="MatObj_MultRowVectorLeft">
+##
+##
+##
+##
+## nothing
+##
+##
+## These operations multiply mul with vec in-place
+## where MultRowVectorLeft multiplies with mul from the left
+## and MultRowVectorRight does so from the right.
+##
+## Note that MultRowVector is just a synonym for
+## MultRowVectorLeft.
+##
+## If the optional parameters from and to are given only the
+## index range [from..to] is guaranteed to be
+## affected. Other indices may be affected, if it is more convenient
+## to do so.
+## This can be helpful if entries of vec are known to be zero.
+##
+## If from is bigger than to, the operation does nothing.
+##
+##
+## <#/GAPDoc>
+##
+DeclareOperation( "MultRowVectorLeft",
[ IsVectorObj and IsMutable, IsObject ] );
-
-#
-# Also, make it explicit from which side we multiply
-# DeclareOperation( "MultRowVectorFromLeft",
-# [ IsVectorObj and IsMutable, IsObject ] );
-# DeclareOperation( "MultRowVectorFromRight",
-# [ IsVectorObj and IsMutable, IsObject ] );
-#DeclareSynonym( "MultRowVector", MultRowVectorFromRight );
-
-# do we really need the following? for what? is any code using this right now?
-# ( a, pa, b, pb, s ) -> a{pa} := b{pb} * s;
-DeclareOperation( "MultRowVector",
- [ IsVectorObj and IsMutable, IsList, IsVectorObj, IsList, IsObject ] );
-
-# maybe have this: vec := vec{[from..to]} * scal ?? cvec has it
+DeclareOperation( "MultRowVectorRight",
+ [ IsVectorObj and IsMutable, IsObject ] );
+DeclareOperation( "MultRowVectorLeft",
+ [ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ] );
+DeclareOperation( "MultRowVectorRight",
+ [ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ] );
+# Note that MultRowVector is declared a synonym for MultRowVectorLeft in
+# listcoef.gd
# The following operations for scalars and vectors are possible for scalars in the BaseDomain
diff --git a/lib/matobjplist.gi b/lib/matobjplist.gi
index 435cca51ac..70a9b53266 100644
--- a/lib/matobjplist.gi
+++ b/lib/matobjplist.gi
@@ -415,30 +415,29 @@ InstallMethod( AddRowVector,
fi;
end );
-InstallMethod( MultRowVector, "for a plist vector, and a scalar",
+InstallMethod( MultRowVectorLeft,
+ "for a plist vector, and an object",
[ IsPlistVectorRep and IsMutable, IsObject ],
function( v, s )
- MULT_ROW_VECTOR_2(v![ELSPOS],s);
+ MULT_ROW_VECTOR_LEFT_2(v![ELSPOS],s);
end );
-InstallMethod( MultRowVector, "for a plist vector, and a scalar",
- [ IsPlistVectorRep and IsIntVector and IsMutable, IsObject ],
+InstallMethod( MultRowVectorRight,
+ "for a plist vector, and an object",
+ [ IsPlistVectorRep and IsMutable, IsObject ],
function( v, s )
- if IsSmallIntRep(s) then
- MULT_ROW_VECTOR_2_FAST(v![ELSPOS],s);
- else
- MULT_ROW_VECTOR_2(v![ELSPOS],s);
- fi;
+ MULT_ROW_VECTOR_RIGHT_2(v![ELSPOS],s);
end );
-InstallMethod( MultRowVector,
- "for a plist vector, a list, a plist vector, a list, and a scalar",
- [ IsPlistVectorRep and IsMutable, IsList,
- IsPlistVectorRep, IsList, IsObject ],
- function( a, pa, b, pb, s )
- a![ELSPOS]{pa} := b![ELSPOS]{pb} * s;
+InstallOtherMethod( MultRowVectorLeft, "for an integer vector, and a small integer",
+ [ IsPlistVectorRep and IsIntVector and IsMutable, IsSmallIntRep ],
+ function( v, s )
+ MULT_ROW_VECTOR_2_FAST(v![ELSPOS],s);
end );
+# The four argument version of MultRowVectorLeft / ..Right uses the generic
+# implementation in matobj.gi
+
InstallMethod( \*, "for a plist vector and a scalar",
[ IsPlistVectorRep, IsScalar ],
function( v, s )
diff --git a/lib/obsolete.gd b/lib/obsolete.gd
index cfff7aa5f9..fa109124c5 100644
--- a/lib/obsolete.gd
+++ b/lib/obsolete.gd
@@ -573,6 +573,33 @@ DeclareObsoleteSynonym( "MutableNullMat", "NullMat" );
## Not used in any redistributed packages (11/2017)
#DeclareOperation( "PositionFirstComponent", [IsList,IsObject] );
+#############################################################################
+##
+#O MultRowVector( , , , , )
+##
+## <#GAPDoc Label="MultRowVector_Obsolete">
+##
+##
+## nothing
+##
+##
+## The two argument version of this operation is an obsolete synonym for
+## MultVectorLeft, which calculates mul*list1 in-place.
+## New code should use MultVectorLeft or its synonym
+## MultVector instead.
+##
+## The five argument version of this operation is kept for compatibility
+## with older versions of &GAP; and will be removed eventually.
+## It replaces
+## list1[poss1[i]] by
+## mul*list2[poss2[i]] for i
+## between 1 and Length( poss1 ).
+##
+##
+## <#/GAPDoc>
+##
+DeclareObsoleteSynonym( "MultRowVector", "MultVector" );
+
#############################################################################
##
#O ReadTest
diff --git a/lib/obsolete.gi b/lib/obsolete.gi
index a2235cb2e7..3d7316b0be 100644
--- a/lib/obsolete.gi
+++ b/lib/obsolete.gi
@@ -168,7 +168,7 @@
# mat{[d..nrrows]}[pivl] := col;
# fi;
# if mat[d][d] < 0 then
-# MultRowVector(mat[d],-1);
+# MultVector(mat[d],-1);
# fi;
#
# # now perform row operations so that the entries in the
@@ -252,7 +252,7 @@
# mat{[d..nrrows]}[pivl] := col;
# fi;
# if mat[d][d] < 0 then
-# MultRowVector(mat[d],-1);
+# MultVector(mat[d],-1);
# fi;
#
# # now perform row operations so that the entries in the
@@ -877,6 +877,28 @@ end);
# # fi;
# end );
+#############################################################################
+##
+#M MultVector( , , , , )
+##
+InstallOtherMethod( MultVector, "obsolete five argument method",
+ true,
+ [ IsDenseList and IsMutable,
+ IsDenseList,
+ IsDenseList,
+ IsDenseList,
+ IsObject ],
+ 0,
+function( l1, p1, l2, p2, m )
+ InfoObsolete(1, "This usage of `MultVector` is no longer",
+ "supported and will be removed eventually." );
+ l1{p1} := m * l2{p2};
+end );
+
+InstallOtherMethod( MultVector, "error if immutable", true,
+ [ IsList,IsObject,IsObject,IsObject,IsObject],0,
+ L1_IMMUTABLE_ERROR);
+
#############################################################################
##
#F SetUserPreferences
diff --git a/src/listoper.c b/src/listoper.c
index 20bfaf9e97..6a4be312d2 100644
--- a/src/listoper.c
+++ b/src/listoper.c
@@ -1315,7 +1315,7 @@ Obj FuncINV_MATRIX_IMMUTABLE( Obj self, Obj mat)
/* We need these to redispatch when the user has supplied a replacement value. */
static Obj AddRowVectorOp; /* BH changed to static */
-static Obj MultRowVectorOp; /* BH changed to static */
+static Obj MultRowVectorLeftOp; /* BH changed to static */
Obj FuncADD_ROW_VECTOR_5( Obj self,
Obj list1,
@@ -1547,30 +1547,46 @@ Obj FuncADD_ROW_VECTOR_2_FAST ( Obj self,
/****************************************************************************
**
-*F FuncMULT_ROW_VECTOR_2( , , )
+*F MULT_ROW_VECTOR_LEFT_RIGHT_2( , , )
**
-** This function destructively multiplies the entries of by
-** It does very little checking
+** This function destructively multiplies the entries of by .
+** It multiplies with from the left if is not 0 and from the
+** right otherwise.
+** It does very little checking.
**
*/
-
-Obj FuncMULT_ROW_VECTOR_2( Obj self,
- Obj list,
- Obj mult )
+static inline Obj MULT_ROW_VECTOR_LEFT_RIGHT_2(Obj list, Obj mult, UInt left)
{
UInt i;
Obj prd;
UInt len = LEN_LIST(list);
- for (i = 1; i <= len; i++)
- {
- prd = ELMW_LIST(list,i);
- prd = PROD(prd,mult);
- ASS_LIST(list,i,prd);
- CHANGED_BAG(list);
- }
+ if (left != 0)
+ for (i = 1; i <= len; i++) {
+ prd = ELMW_LIST(list, i);
+ prd = PROD(mult, prd);
+ ASS_LIST(list, i, prd);
+ CHANGED_BAG(list);
+ }
+ else
+ for (i = 1; i <= len; i++) {
+ prd = ELMW_LIST(list, i);
+ prd = PROD(prd, mult);
+ ASS_LIST(list, i, prd);
+ CHANGED_BAG(list);
+ }
return 0;
}
+Obj FuncMULT_ROW_VECTOR_LEFT_2(Obj self, Obj list, Obj mult)
+{
+ return MULT_ROW_VECTOR_LEFT_RIGHT_2(list, mult, 1);
+}
+
+Obj FuncMULT_ROW_VECTOR_RIGHT_2(Obj self, Obj list, Obj mult)
+{
+ return MULT_ROW_VECTOR_LEFT_RIGHT_2(list, mult, 0);
+}
+
/****************************************************************************
**
*F FuncMULT_ROW_VECTOR_2_FAST( , , )
@@ -1642,7 +1658,7 @@ Obj FuncPROD_VEC_MAT_DEFAULT( Obj self,
if (res == (Obj)0)
{
res = SHALLOW_COPY_OBJ(vecr);
- CALL_2ARGS(MultRowVectorOp,res,elt);
+ CALL_2ARGS(MultRowVectorLeftOp, res, elt);
}
else
CALL_3ARGS(AddRowVectorOp, res, vecr, elt);
@@ -1660,7 +1676,7 @@ Obj FuncPROD_VEC_MAT_DEFAULT( Obj self,
*F FuncINV_MAT_DEFAULT
**
** A faster version of InvMat for those matrices for whose rows AddRowVector
-** and MultRowVector make sense (and might have fast kernel methods)
+** and MultRowVectorLeft make sense (and might have fast kernel methods)
**
*/
@@ -1761,8 +1777,8 @@ Obj InvMatWithRowVecs( Obj mat, UInt mut)
if (!EQ(x, one))
{
xi = INV(x);
- CALL_2ARGS(MultRowVectorOp, row, xi);
- CALL_2ARGS(MultRowVectorOp, row2, xi);
+ CALL_2ARGS(MultRowVectorLeftOp, row, xi);
+ CALL_2ARGS(MultRowVectorLeftOp, row2, xi);
}
/* Clear the entries. We know that we can ignore the entries in rows i..j */
@@ -2187,7 +2203,7 @@ static Obj FuncMONOM_PROD( Obj self, Obj m1, Obj m2 ) {
**
*V GVarFuncs . . . . . . . . . . . . . . . . . . list of functions to export
*/
-static StructGVarFunc GVarFuncs [] = {
+static StructGVarFunc GVarFuncs[] = {
GVAR_FUNC(EQ_LIST_LIST_DEFAULT, 2, "listL, listR"),
GVAR_FUNC(LT_LIST_LIST_DEFAULT, 2, "listL, listR"),
@@ -2218,7 +2234,8 @@ static StructGVarFunc GVarFuncs [] = {
GVAR_FUNC(ADD_ROW_VECTOR_3_FAST, 3, "list1, list2, mult"),
GVAR_FUNC(ADD_ROW_VECTOR_2, 2, "list1, list2"),
GVAR_FUNC(ADD_ROW_VECTOR_2_FAST, 2, "list1, list2"),
- GVAR_FUNC(MULT_ROW_VECTOR_2, 2, "list, mult"),
+ GVAR_FUNC(MULT_ROW_VECTOR_LEFT_2, 2, "list, mult"),
+ GVAR_FUNC(MULT_ROW_VECTOR_RIGHT_2, 2, "list, mult"),
GVAR_FUNC(MULT_ROW_VECTOR_2_FAST, 2, "list, mult"),
GVAR_FUNC(PROD_VEC_MAT_DEFAULT, 2, "vec, mat"),
GVAR_FUNC(INV_MAT_DEFAULT_MUTABLE, 1, "mat"),
@@ -2250,7 +2267,7 @@ static Int InitKernel (
InitHdlrFuncsFromTable( GVarFuncs );
InitFopyGVar( "AddRowVector", &AddRowVectorOp );
- InitFopyGVar( "MultRowVector", &MultRowVectorOp );
+ InitFopyGVar("MultRowVectorLeft", &MultRowVectorLeftOp);
InitFopyGVar( "ConvertToMatrixRep", &ConvertToMatrixRep );
diff --git a/src/vecffe.c b/src/vecffe.c
index b26a9da202..4d3bbaf4b8 100644
--- a/src/vecffe.c
+++ b/src/vecffe.c
@@ -738,7 +738,7 @@ Obj FuncADD_ROWVECTOR_VECFFES_3( Obj self, Obj vecL, Obj vecR, Obj mult )
**
*/
-static Obj MultRowVectorOp; /* BH changed to static */
+static Obj MultRowVectorLeftOp; /* BH changed to static */
Obj FuncMULT_ROWVECTOR_VECFFES( Obj self, Obj vec, Obj mult )
{
@@ -775,7 +775,7 @@ Obj FuncMULT_ROWVECTOR_VECFFES( Obj self, Obj vec, Obj mult )
"MultRowVector: has different field",
0L, 0L,
"you can replace via 'return ;'");
- return CALL_2ARGS(MultRowVectorOp, vec, mult);
+ return CALL_2ARGS(MultRowVectorLeftOp, vec, mult);
}
/* if the multiplier is over a non subfield then redispatch */
diff --git a/tst/test-matobj/MultVector.tst b/tst/test-matobj/MultVector.tst
new file mode 100644
index 0000000000..a13a7b5bf3
--- /dev/null
+++ b/tst/test-matobj/MultVector.tst
@@ -0,0 +1,45 @@
+gap> START_TEST("MultVector.tst");
+
+# Finite Fields
+gap> v := NewVector( IsPlistVectorRep, GF(5), [Z(5)^1, Z(5)^2, Z(5)^0, Z(5)^4, 0*Z(5), Z(5)^3 ] );
+
+gap> MultVector(v, Z(5)^3);
+gap> Unpack(v);
+[ Z(5)^0, Z(5), Z(5)^3, Z(5)^3, 0*Z(5), Z(5)^2 ]
+gap> MultVector(v, -1);
+gap> Unpack(v);
+[ Z(5)^2, Z(5)^3, Z(5), Z(5), 0*Z(5), Z(5)^0 ]
+gap> MultVector(v, Z(5)^3, 3, 4);
+gap> Unpack(v);
+[ Z(5)^2, Z(5)^3, Z(5)^0, Z(5)^0, 0*Z(5), Z(5)^0 ]
+
+# Integers
+gap> n := NewVector( IsPlistVectorRep, Integers, [1,2,0] );
+
+gap> IsIntVector(n);
+true
+gap> MultVector(n, 2);
+gap> Unpack(n);
+[ 2, 4, 0 ]
+
+# Quaternions: multiplication from left and right
+gap> Q := QuaternionAlgebra( Rationals );
+
+gap> q := NewVector( IsPlistVectorRep, Q, [One(Q), Zero(Q), Q.2, Q.3] );
+
+gap> MultVectorRight(q, Q.2);
+gap> Unpack(q);
+[ i, 0*e, (-1)*e, (-1)*k ]
+gap> MultVectorLeft(q, Q.2);
+gap> Unpack(q);
+[ (-1)*e, 0*e, (-1)*i, j ]
+gap> MultVectorRight(q, 1);
+gap> Unpack(q);
+[ (-1)*e, 0*e, (-1)*i, j ]
+gap> MultVectorRight(q, Q.2, 3, 4);
+gap> Unpack(q);
+[ (-1)*e, 0*e, e, (-1)*k ]
+gap> MultVectorLeft(q, Q.2, 3, 4);
+gap> Unpack(q);
+[ (-1)*e, 0*e, i, j ]
+gap> STOP_TEST("MultVector.tst");
From 6fa2c189d7a219f33843864174a41d68cc474260 Mon Sep 17 00:00:00 2001
From: Sergio Siccha
Date: Wed, 12 Sep 2018 14:45:49 +0200
Subject: [PATCH 2/2] Rename MultRowVector to MultVector
Performs the following sed commands in the directories
`lib/`, `src/`, `hpcgap/`. Then undo the changes in
the `obsolete.{gd,gi}` files.
sed -i 's/MULT_ROW_VECTOR/MULT_VECTOR/g' `find . -type f`
sed -i 's/MULT_ROWVECTOR/MULT_VECTOR/g' `find . -type f`
sed -i 's/MultRowVector/MultVector/g' `find . -type f`
git checkout -- obsolete.{gd,gi}
Also perform:
sed -i 's/MultRowVector/MultVector/g' doc/ref/vector.xml
---
doc/ref/vector.xml | 2 +-
hpcgap/lib/ffeconway.gi | 2 +-
hpcgap/lib/polyrat.gi | 8 ++++----
hpcgap/lib/vec8bit.gi | 6 +++---
hpcgap/lib/vecmat.gi | 10 +++++-----
lib/claspcgs.gi | 2 +-
lib/ffeconway.gi | 2 +-
lib/grpffmat.gi | 2 +-
lib/listcoef.gd | 18 +++++++++---------
lib/listcoef.gi | 18 +++++++++---------
lib/matobj.gi | 8 ++++----
lib/matobj2.gd | 34 +++++++++++++++++-----------------
lib/matobjplist.gi | 14 +++++++-------
lib/matrix.gi | 24 ++++++++++++------------
lib/meataxe.gi | 2 +-
lib/onecohom.gi | 4 ++--
lib/polyrat.gi | 8 ++++----
lib/sparsevectorsorted.gi | 6 +++---
lib/vec8bit.gi | 6 +++---
lib/vecmat.gi | 10 +++++-----
lib/vspcmat.gi | 2 +-
lib/vspcrow.gi | 2 +-
src/listoper.c | 34 +++++++++++++++++-----------------
src/vec8bit.c | 6 +++---
src/vecffe.c | 12 ++++++------
src/vecgf2.c | 6 +++---
26 files changed, 124 insertions(+), 124 deletions(-)
diff --git a/doc/ref/vector.xml b/doc/ref/vector.xml
index fd336ebd96..7afeb6c600 100644
--- a/doc/ref/vector.xml
+++ b/doc/ref/vector.xml
@@ -190,7 +190,7 @@ than the natural
field of the problem.
<#Include Label="[1]{listcoef}">
<#Include Label="AddRowVector">
<#Include Label="AddCoeffs">
-<#Include Label="MultRowVector">
+<#Include Label="MultVector">
<#Include Label="CoeffsMod">
diff --git a/hpcgap/lib/ffeconway.gi b/hpcgap/lib/ffeconway.gi
index a4416dde81..6f4b6107f4 100644
--- a/hpcgap/lib/ffeconway.gi
+++ b/hpcgap/lib/ffeconway.gi
@@ -955,7 +955,7 @@ InstallMethod(InverseOp,
s := t;
od;
Assert(1,Length(a) = 1);
- MultRowVector(r,Inverse(a[1]));
+ MultVector(r,Inverse(a[1]));
if AssertionLevel() >= 2 then
t := ProductCoeffs(x![1],r);
fam!.ConwayFldEltReducers[d](t);
diff --git a/hpcgap/lib/polyrat.gi b/hpcgap/lib/polyrat.gi
index b33a162549..63b7d59c4d 100644
--- a/hpcgap/lib/polyrat.gi
+++ b/hpcgap/lib/polyrat.gi
@@ -563,7 +563,7 @@ local fam,gcd, u, v, w, val, r, s;
od;
#gcd := u * (a/u[Length(u)]);
gcd:=u;
- MultRowVector(gcd,a/u[Length(u)]);
+ MultVector(gcd,a/u[Length(u)]);
ReduceCoeffsMod(gcd,p);
# and return the polynomial
@@ -943,19 +943,19 @@ BindGlobal("RPGcdRepresentationModPrime",function(f,g,p)
# convert and back into polynomials
if 0 = Length(g) then
#sx := q * sx;
- MultRowVector(sx,q);
+ MultVector(sx,q);
ReduceCoeffsMod(sx,p);
return [ LaurentPolynomialByCoefficients(brci[1],sx,0,brci[2]),
Zero(brci[1]) ];
else
#hx := q * sx;
hx:=ShallowCopy(sx);
- MultRowVector(hx,q);
+ MultVector(hx,q);
ReduceCoeffsMod(hx,p);
hx := LaurentPolynomialByCoefficients(brci[1],hx,0,brci[2]);
AddCoeffs(s,ProductCoeffs(sx,f),-1);
#s := q * s;
- MultRowVector(s,q);
+ MultVector(s,q);
ReduceCoeffsMod(s,p);
s := LaurentPolynomialByCoefficients(brci[1],s,0,brci[2]);
g := LaurentPolynomialByCoefficients(brci[1],g,0,brci[2]);
diff --git a/hpcgap/lib/vec8bit.gi b/hpcgap/lib/vec8bit.gi
index 928f0f955e..0f700da593 100644
--- a/hpcgap/lib/vec8bit.gi
+++ b/hpcgap/lib/vec8bit.gi
@@ -583,15 +583,15 @@ InstallOtherMethod( AddRowVector, "For 2 8 bit vectors",
#############################################################################
##
-#M MultRowVector( , )
+#M MultVector( , )
##
## multiply by in place
##
-InstallOtherMethod( MultRowVector, "For an 8 bit vector and an ffe",
+InstallOtherMethod( MultVector, "For an 8 bit vector and an ffe",
IsCollsElms, [ IsRowVector and Is8BitVectorRep,
IsFFE and IsInternalRep], 0,
- MULT_ROWVECTOR_VEC8BITS);
+ MULT_VECTOR_VEC8BITS);
#############################################################################
##
diff --git a/hpcgap/lib/vecmat.gi b/hpcgap/lib/vecmat.gi
index 8c559c23f3..26828f9c21 100644
--- a/hpcgap/lib/vecmat.gi
+++ b/hpcgap/lib/vecmat.gi
@@ -1809,13 +1809,13 @@ end);
#############################################################################
##
-#M MultRowVector( , )
+#M MultVector( , )
##
-InstallOtherMethod( MultRowVector, "for GF(2) vector and char 2 scalar",
+InstallOtherMethod( MultVector, "for GF(2) vector and char 2 scalar",
IsCollsElms, [IsGF2VectorRep and IsRowVector and IsMutable,
IsFFE], 0,
- MULT_ROW_VECTOR_GF2VECS_2);
+ MULT_VECTOR_GF2VECS_2);
#############################################################################
##
@@ -2361,7 +2361,7 @@ InstallMethod( Randomize, "for a mutable gf2 vector",
[ IsGF2VectorRep and IsMutable ],
function( v )
local i;
- MultRowVector(v,0);
+ MultVector(v,0);
for i in [1..Length(v)] do
if Random(0,1) = 1 then v[i] := Z(2); fi;
od;
@@ -2371,7 +2371,7 @@ InstallMethod( Randomize, "for a mutable gf2 vector and a random source",
[ IsGF2VectorRep and IsMutable, IsRandomSource ],
function( v, rs )
local i;
- MultRowVector(v,0);
+ MultVector(v,0);
for i in [1..Length(v)] do
if Random(rs,0,1) = 1 then v[i] := Z(2); fi;
od;
diff --git a/lib/claspcgs.gi b/lib/claspcgs.gi
index a9916bc9f6..9262423ff5 100644
--- a/lib/claspcgs.gi
+++ b/lib/claspcgs.gi
@@ -208,7 +208,7 @@ local classes, # classes to be constructed, the result
if IsIdenticalObj( FamilyObj( U ), FamilyObj( cl.candidates ) ) then
for c in cl.candidates do
exp:=ExponentsOfPcElement( N, LeftQuotient( h, c ) );
- MultRowVector( exp, One( field ) );
+ MultVector( exp, One( field ) );
w:=exp * N!.subspace.projection;
exp{ N!.subspace.baseComplement }:=
exp{ N!.subspace.baseComplement }-w;
diff --git a/lib/ffeconway.gi b/lib/ffeconway.gi
index e5c54a0885..9f571165dc 100644
--- a/lib/ffeconway.gi
+++ b/lib/ffeconway.gi
@@ -925,7 +925,7 @@ InstallMethod(InverseOp,
s := t;
od;
Assert(1,Length(a) = 1);
- MultRowVector(r,Inverse(a[1]));
+ MultVector(r,Inverse(a[1]));
if AssertionLevel() >= 2 then
t := ProductCoeffs(x![1],r);
fam!.ConwayFldEltReducers[d](t);
diff --git a/lib/grpffmat.gi b/lib/grpffmat.gi
index 5bc3f0928a..bd41a441d8 100644
--- a/lib/grpffmat.gi
+++ b/lib/grpffmat.gi
@@ -529,7 +529,7 @@ function(rs, G)
local m;
m:= RandomInvertibleMat( rs, DimensionOfMatrixGroup( G ),
FieldOfMatrixGroup( G ) );
- MultRowVector(m[1], DeterminantMat(m)^-1);
+ MultVector(m[1], DeterminantMat(m)^-1);
return ImmutableMatrix(FieldOfMatrixGroup(G), m, true);
end);
diff --git a/lib/listcoef.gd b/lib/listcoef.gd
index a895d7f5e1..717e223c4c 100644
--- a/lib/listcoef.gd
+++ b/lib/listcoef.gd
@@ -97,29 +97,29 @@ DeclareOperation(
#############################################################################
##
-#O MultRowVectorLeft( , )
+#O MultVectorLeft( , )
##
-## <#GAPDoc Label="MultRowVector">
+## <#GAPDoc Label="MultVector">
##
-##
-##
+##
+##
## nothing
##
##
## This operation calculates mul*list1 in-place.
##
-## Note that MultRowVector is just a synonym for
-## MultRowVectorLeft.
+## Note that MultVector is just a synonym for
+## MultVectorLeft.
##
##
## <#/GAPDoc>
##
DeclareOperation(
- "MultRowVectorLeft",
+ "MultVectorLeft",
[ IsMutable and IsList,
IsObject ] );
-# For VectorObj objects there also exists a MultRowVectorRight operation
-DeclareSynonym( "MultRowVector", MultRowVectorLeft );
+# For VectorObj objects there also exists a MultVectorRight operation
+DeclareSynonym( "MultVector", MultVectorLeft );
#############################################################################
##
diff --git a/lib/listcoef.gi b/lib/listcoef.gi
index 6c7f2602bb..88884ef883 100644
--- a/lib/listcoef.gi
+++ b/lib/listcoef.gi
@@ -262,9 +262,9 @@ end );
#############################################################################
##
-#M MultRowVectorLeft( , )
+#M MultVectorLeft( , )
##
-InstallMethod( MultRowVectorLeft,
+InstallMethod( MultVectorLeft,
"for a mutable dense list, and an object",
[ IsDenseList and IsMutable,
IsObject ],
@@ -274,32 +274,32 @@ function( l, m )
l[i] := m * l[i];
od;
end );
-InstallOtherMethod( MultRowVectorLeft, "error if immutable",
+InstallOtherMethod( MultVectorLeft, "error if immutable",
[ IsList, IsObject ],
L1_IMMUTABLE_ERROR);
-InstallMethod( MultRowVectorLeft,
+InstallMethod( MultVectorLeft,
"kernel method for a mutable dense small list, and an object",
IsCollsElms,
[ IsSmallList and IsDenseList and IsMutable,
IsObject ],
- MULT_ROW_VECTOR_LEFT_2
+ MULT_VECTOR_LEFT_2
);
-InstallMethod( MultRowVectorLeft,
+InstallMethod( MultVectorLeft,
"kernel method for a mutable dense plain list of \
cyclotomics, and a cyclotomic",
IsCollsElms,
[ IsDenseList and IsMutable and IsPlistRep and IsCyclotomicCollection,
IsCyclotomic ],
- MULT_ROW_VECTOR_2_FAST
+ MULT_VECTOR_2_FAST
);
-InstallMethod( MultRowVectorLeft,
+InstallMethod( MultVectorLeft,
"kernel method for a mutable row vector of ffes in \
plain list rep, and an ffe",
IsCollsElms,
[ IsRowVector and IsMutable and IsPlistRep and IsFFECollection,
IsFFE],0,
- MULT_ROWVECTOR_VECFFES );
+ MULT_VECTOR_VECFFES );
#############################################################################
diff --git a/lib/matobj.gi b/lib/matobj.gi
index f6c765b6a8..af5e941b8d 100644
--- a/lib/matobj.gi
+++ b/lib/matobj.gi
@@ -589,7 +589,7 @@ end );
############################################################################
# Arithmetical operations:
############################################################################
-InstallMethod( MultRowVectorLeft,
+InstallMethod( MultVectorLeft,
"generic method for a mutable vector, and an object",
[ IsVectorObj and IsMutable, IsObject ],
function( v, s )
@@ -599,7 +599,7 @@ InstallMethod( MultRowVectorLeft,
od;
end );
-InstallMethod( MultRowVectorRight,
+InstallMethod( MultVectorRight,
"generic method for a mutable vector, and an object",
[ IsVectorObj and IsMutable, IsObject ],
function( v, s )
@@ -609,7 +609,7 @@ InstallMethod( MultRowVectorRight,
od;
end );
-InstallMethod( MultRowVectorLeft,
+InstallMethod( MultVectorLeft,
"generic method for a mutable vector, an object, an int, \
and an int",
[ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ],
@@ -620,7 +620,7 @@ and an int",
od;
end );
-InstallMethod( MultRowVectorRight,
+InstallMethod( MultVectorRight,
"generic method for a mutable vector, an object, an int, \
and an int",
[ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ],
diff --git a/lib/matobj2.gd b/lib/matobj2.gd
index d4e472191f..b96e3f406d 100644
--- a/lib/matobj2.gd
+++ b/lib/matobj2.gd
@@ -384,24 +384,24 @@ DeclareOperation( "AddRowVector",
#############################################################################
##
-#O MultRowVector( , [, , ] )
-#O MultRowVectorLeft( , [, , ] )
-#O MultRowVectorRight( , [, , ] )
+#O MultVector( , [, , ] )
+#O MultVectorLeft( , [, , ] )
+#O MultVectorRight( , [, , ] )
##
-## <#GAPDoc Label="MatObj_MultRowVectorLeft">
+## <#GAPDoc Label="MatObj_MultVectorLeft">
##
-##
-##
-##
+##
+##
+##
## nothing
##
##
## These operations multiply mul with vec in-place
-## where MultRowVectorLeft multiplies with mul from the left
-## and MultRowVectorRight does so from the right.
+## where MultVectorLeft multiplies with mul from the left
+## and MultVectorRight does so from the right.
##
-## Note that MultRowVector is just a synonym for
-## MultRowVectorLeft.
+## Note that MultVector is just a synonym for
+## MultVectorLeft.
##
## If the optional parameters from and to are given only the
## index range [from..to] is guaranteed to be
@@ -414,15 +414,15 @@ DeclareOperation( "AddRowVector",
##
## <#/GAPDoc>
##
-DeclareOperation( "MultRowVectorLeft",
+DeclareOperation( "MultVectorLeft",
[ IsVectorObj and IsMutable, IsObject ] );
-DeclareOperation( "MultRowVectorRight",
+DeclareOperation( "MultVectorRight",
[ IsVectorObj and IsMutable, IsObject ] );
-DeclareOperation( "MultRowVectorLeft",
+DeclareOperation( "MultVectorLeft",
[ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ] );
-DeclareOperation( "MultRowVectorRight",
+DeclareOperation( "MultVectorRight",
[ IsVectorObj and IsMutable, IsObject, IsInt, IsInt ] );
-# Note that MultRowVector is declared a synonym for MultRowVectorLeft in
+# Note that MultVector is declared a synonym for MultVectorLeft in
# listcoef.gd
@@ -601,7 +601,7 @@ DeclareOperation( "Randomize", [IsVectorObj and IsMutable,IsRandomSource] );
##
## TODO: link to ExtractSubVector
##
-## TODO: In AddRowVector and MultRowVector, the destination is always the first argument;
+## TODO: In AddRowVector and MultVector, the destination is always the first argument;
## it would be better if we were consistent...
##
## TODO: Maybe also have a version of this as follows:
diff --git a/lib/matobjplist.gi b/lib/matobjplist.gi
index 70a9b53266..2df8963277 100644
--- a/lib/matobjplist.gi
+++ b/lib/matobjplist.gi
@@ -415,27 +415,27 @@ InstallMethod( AddRowVector,
fi;
end );
-InstallMethod( MultRowVectorLeft,
+InstallMethod( MultVectorLeft,
"for a plist vector, and an object",
[ IsPlistVectorRep and IsMutable, IsObject ],
function( v, s )
- MULT_ROW_VECTOR_LEFT_2(v![ELSPOS],s);
+ MULT_VECTOR_LEFT_2(v![ELSPOS],s);
end );
-InstallMethod( MultRowVectorRight,
+InstallMethod( MultVectorRight,
"for a plist vector, and an object",
[ IsPlistVectorRep and IsMutable, IsObject ],
function( v, s )
- MULT_ROW_VECTOR_RIGHT_2(v![ELSPOS],s);
+ MULT_VECTOR_RIGHT_2(v![ELSPOS],s);
end );
-InstallOtherMethod( MultRowVectorLeft, "for an integer vector, and a small integer",
+InstallOtherMethod( MultVectorLeft, "for an integer vector, and a small integer",
[ IsPlistVectorRep and IsIntVector and IsMutable, IsSmallIntRep ],
function( v, s )
- MULT_ROW_VECTOR_2_FAST(v![ELSPOS],s);
+ MULT_VECTOR_2_FAST(v![ELSPOS],s);
end );
-# The four argument version of MultRowVectorLeft / ..Right uses the generic
+# The four argument version of MultVectorLeft / ..Right uses the generic
# implementation in matobj.gi
InstallMethod( \*, "for a plist vector and a scalar",
diff --git a/lib/matrix.gi b/lib/matrix.gi
index d715bd3398..2fc8d3349b 100644
--- a/lib/matrix.gi
+++ b/lib/matrix.gi
@@ -414,10 +414,10 @@ BindGlobal( "Matrix_OrderPolynomialInner", function( fld, mat, vec, vecs)
if piv <=d then
x := Inverse(w[piv]);
- MultRowVector(p, x);
+ MultVector(p, x);
MakeImmutable(p);
pols[piv] := p;
- MultRowVector(w, x );
+ MultVector(w, x );
MakeImmutable(w);
vecs[piv] := w;
vec := vec*mat;
@@ -541,7 +541,7 @@ BindGlobal( "Matrix_MinimalPolynomialSameField", function( fld, mat, ind )
piv := PositionNonZero(w, piv);
until piv > n or not IsBound(base[piv]);
if piv <= n then
- MultRowVector(w,Inverse(w[piv]));
+ MultVector(w,Inverse(w[piv]));
MakeImmutable(w);
base[piv] := w;
dim := dim+1;
@@ -1353,11 +1353,11 @@ InstallMethod( DeterminantMatDestructive,
row2 := mat[j];
mult := -row2[k];
if mult <> zero then
- MultRowVector( row2, piv );
+ MultVector( row2, piv );
AddRowVector( row2, row, mult, k, m );
- MultRowVector( row2, Inverse(det) );
+ MultVector( row2, Inverse(det) );
else
- MultRowVector( row2, piv/det);
+ MultVector( row2, piv/det);
fi;
od;
@@ -1435,7 +1435,7 @@ function( mat )
# ... and normalize the row.
x := row[k];
det := det * x;
- MultRowVector( mat[k], Inverse(x) );
+ MultVector( mat[k], Inverse(x) );
# clear all entries in this column, adjust only columns > k
# (Note that we need not clear the rows from 'k+1' to 'j'.)
@@ -1709,11 +1709,11 @@ local R,M,transform,divide,swaprow, swapcol, addcol, addrow, multcol, multrow, l
end;
multrow:=function(a,m)
- MultRowVector(M[a],m);
+ MultVector(M[a],m);
if transform then
- MultRowVector(left[a],m);
+ MultVector(left[a],m);
if basmat<>fail then
- MultRowVector(basmat[a],1/m);
+ MultVector(basmat[a],1/m);
fi;
fi;
end;
@@ -2310,7 +2310,7 @@ InstallMethod( SemiEchelonMatDestructive,
if inv = fail then
return fail;
fi;
- MultRowVector( row, inv );
+ MultVector( row, inv );
Add( vectors, row );
Add( nzheads, j );
heads[j]:= Length( vectors );
@@ -2958,7 +2958,7 @@ InstallMethod( TriangulizeMat,
if x = fail then
TryNextMethod();
fi;
- MultRowVector( row, x );
+ MultVector( row, x );
mat[i] := row;
# clear all entries in this column
diff --git a/lib/meataxe.gi b/lib/meataxe.gi
index 83d6900e36..d6e588a6cf 100644
--- a/lib/meataxe.gi
+++ b/lib/meataxe.gi
@@ -421,7 +421,7 @@ SMTX_SpinnedBasis:=function( arg )
subdim:=subdim + 1;
leadpos[subdim]:=j;
#w:=(w[j]^-1) * w;
- MultRowVector(w,w[j]^-1);
+ MultVector(w,w[j]^-1);
Add( ans, w );
if subdim = dim then
ans:=ImmutableMatrix(F,ans);
diff --git a/lib/onecohom.gi b/lib/onecohom.gi
index 3e79fb5f8b..c9d924ea28 100644
--- a/lib/onecohom.gi
+++ b/lib/onecohom.gi
@@ -1238,14 +1238,14 @@ local cobounds,cocycles, # base of one coboundaries and cocycles
Append(RS,OCSmallEquationMatrix(ocr,rels[i],g));
od;
RR:=OCSmallEquationVector(ocr,rels[i]);
- MultRowVector(RR,-One(ocr.field));
+ MultVector(RR,-One(ocr.field));
else
for g in gens do
Append(RS,OCEquationMatrix(ocr,rels[i],g));
od;
RR:=OCEquationVector(ocr,rels[i]);
- MultRowVector(RR,-One(ocr.field));
+ MultVector(RR,-One(ocr.field));
fi;
diff --git a/lib/polyrat.gi b/lib/polyrat.gi
index 91204820cd..955b73f1c7 100644
--- a/lib/polyrat.gi
+++ b/lib/polyrat.gi
@@ -551,7 +551,7 @@ local fam,gcd, u, v, w, val, r, s;
od;
#gcd := u * (a/u[Length(u)]);
gcd:=u;
- MultRowVector(gcd,a/u[Length(u)]);
+ MultVector(gcd,a/u[Length(u)]);
ReduceCoeffsMod(gcd,p);
# and return the polynomial
@@ -931,19 +931,19 @@ BindGlobal("RPGcdRepresentationModPrime",function(f,g,p)
# convert and back into polynomials
if 0 = Length(g) then
#sx := q * sx;
- MultRowVector(sx,q);
+ MultVector(sx,q);
ReduceCoeffsMod(sx,p);
return [ LaurentPolynomialByCoefficients(brci[1],sx,0,brci[2]),
Zero(brci[1]) ];
else
#hx := q * sx;
hx:=ShallowCopy(sx);
- MultRowVector(hx,q);
+ MultVector(hx,q);
ReduceCoeffsMod(hx,p);
hx := LaurentPolynomialByCoefficients(brci[1],hx,0,brci[2]);
AddCoeffs(s,ProductCoeffs(sx,f),-1);
#s := q * s;
- MultRowVector(s,q);
+ MultVector(s,q);
ReduceCoeffsMod(s,p);
s := LaurentPolynomialByCoefficients(brci[1],s,0,brci[2]);
g := LaurentPolynomialByCoefficients(brci[1],g,0,brci[2]);
diff --git a/lib/sparsevectorsorted.gi b/lib/sparsevectorsorted.gi
index b15804a25c..5d4a7d60b5 100644
--- a/lib/sparsevectorsorted.gi
+++ b/lib/sparsevectorsorted.gi
@@ -74,7 +74,7 @@ InstallGlobalFunction(SparseVectorBySortedList, function(arg)
return l;
end);
-## AddRowVector, MultRowVector
+## AddRowVector, MultVector
## products with scalars, scalar product, AddCoeffs, MultCoeffs,
## more coeffs functions
## maybe product with matrices
@@ -267,9 +267,9 @@ InstallMethod(DIFF, [IsSparseRowVector and IsSparseListBySortedListRep, IsSparse
function(v1,v2) return SUM(v1, AINV(v2)); end);
-InstallOtherMethod( MultRowVector, [IsSparseRowVector and IsSparseListBySortedListRep and IsMutable, IsMultiplicativeElement],
+InstallOtherMethod( MultVector, [IsSparseRowVector and IsSparseListBySortedListRep and IsMutable, IsMultiplicativeElement],
function(v,x)
- MultRowVector(v![SL_VALS],x);
+ MultVector(v![SL_VALS],x);
end);
InstallMethod( \*, [IsSparseRowVector and IsSparseListBySortedListRep, IsMultiplicativeElement],
diff --git a/lib/vec8bit.gi b/lib/vec8bit.gi
index f514b2b04d..55dcb0fe4f 100644
--- a/lib/vec8bit.gi
+++ b/lib/vec8bit.gi
@@ -572,15 +572,15 @@ InstallOtherMethod( AddRowVector, "For 2 8 bit vectors",
#############################################################################
##
-#M MultRowVector( , )
+#M MultVector( , )
##
## multiply by in place
##
-InstallOtherMethod( MultRowVector, "For an 8 bit vector and an ffe",
+InstallOtherMethod( MultVector, "For an 8 bit vector and an ffe",
IsCollsElms, [ IsRowVector and Is8BitVectorRep,
IsFFE and IsInternalRep], 0,
- MULT_ROWVECTOR_VEC8BITS);
+ MULT_VECTOR_VEC8BITS);
#############################################################################
##
diff --git a/lib/vecmat.gi b/lib/vecmat.gi
index 68a685744d..ec48193f8d 100644
--- a/lib/vecmat.gi
+++ b/lib/vecmat.gi
@@ -1620,13 +1620,13 @@ end);
#############################################################################
##
-#M MultRowVector( , )
+#M MultVector( , )
##
-InstallOtherMethod( MultRowVector, "for GF(2) vector and char 2 scalar",
+InstallOtherMethod( MultVector, "for GF(2) vector and char 2 scalar",
IsCollsElms, [IsGF2VectorRep and IsRowVector and IsMutable,
IsFFE], 0,
- MULT_ROW_VECTOR_GF2VECS_2);
+ MULT_VECTOR_GF2VECS_2);
#############################################################################
##
@@ -2172,7 +2172,7 @@ InstallMethod( Randomize, "for a mutable gf2 vector",
[ IsGF2VectorRep and IsMutable ],
function( v )
local i;
- MultRowVector(v,0);
+ MultVector(v,0);
for i in [1..Length(v)] do
if Random(0,1) = 1 then v[i] := Z(2); fi;
od;
@@ -2182,7 +2182,7 @@ InstallMethod( Randomize, "for a mutable gf2 vector and a random source",
[ IsGF2VectorRep and IsMutable, IsRandomSource ],
function( v, rs )
local i;
- MultRowVector(v,0);
+ MultVector(v,0);
for i in [1..Length(v)] do
if Random(rs,0,1) = 1 then v[i] := Z(2); fi;
od;
diff --git a/lib/vspcmat.gi b/lib/vspcmat.gi
index f4a5f99021..6068c5fa1f 100644
--- a/lib/vspcmat.gi
+++ b/lib/vspcmat.gi
@@ -1072,7 +1072,7 @@ InstallMethod( CloseMutableBasis,
if j <= n then
scalar:= Inverse( v[i][j] );
for k in [ 1 .. m ] do
- MultRowVector( v[k], scalar );
+ MultVector( v[k], scalar );
od;
Add( basisvectors, v );
heads[i][j]:= Length( basisvectors );
diff --git a/lib/vspcrow.gi b/lib/vspcrow.gi
index 077bca45ff..11124e461a 100644
--- a/lib/vspcrow.gi
+++ b/lib/vspcrow.gi
@@ -1583,7 +1583,7 @@ InstallMethod( CloseMutableBasis,
# If necessary add the sifted vector, and update the basis info.
j := PositionNonZero( v );
if j <= ncols then
- MultRowVector( v, Inverse( v[j] ) );
+ MultVector( v, Inverse( v[j] ) );
Add( basisvectors, v );
heads[j]:= Length( basisvectors );
fi;
diff --git a/src/listoper.c b/src/listoper.c
index 6a4be312d2..7d3595f96e 100644
--- a/src/listoper.c
+++ b/src/listoper.c
@@ -1315,7 +1315,7 @@ Obj FuncINV_MATRIX_IMMUTABLE( Obj self, Obj mat)
/* We need these to redispatch when the user has supplied a replacement value. */
static Obj AddRowVectorOp; /* BH changed to static */
-static Obj MultRowVectorLeftOp; /* BH changed to static */
+static Obj MultVectorLeftOp; /* BH changed to static */
Obj FuncADD_ROW_VECTOR_5( Obj self,
Obj list1,
@@ -1547,7 +1547,7 @@ Obj FuncADD_ROW_VECTOR_2_FAST ( Obj self,
/****************************************************************************
**
-*F MULT_ROW_VECTOR_LEFT_RIGHT_2( , , )
+*F MULT_VECTOR_LEFT_RIGHT_2( , , )
**
** This function destructively multiplies the entries of by .
** It multiplies with from the left if is not 0 and from the
@@ -1555,7 +1555,7 @@ Obj FuncADD_ROW_VECTOR_2_FAST ( Obj self,
** It does very little checking.
**
*/
-static inline Obj MULT_ROW_VECTOR_LEFT_RIGHT_2(Obj list, Obj mult, UInt left)
+static inline Obj MULT_VECTOR_LEFT_RIGHT_2(Obj list, Obj mult, UInt left)
{
UInt i;
Obj prd;
@@ -1577,19 +1577,19 @@ static inline Obj MULT_ROW_VECTOR_LEFT_RIGHT_2(Obj list, Obj mult, UInt left)
return 0;
}
-Obj FuncMULT_ROW_VECTOR_LEFT_2(Obj self, Obj list, Obj mult)
+Obj FuncMULT_VECTOR_LEFT_2(Obj self, Obj list, Obj mult)
{
- return MULT_ROW_VECTOR_LEFT_RIGHT_2(list, mult, 1);
+ return MULT_VECTOR_LEFT_RIGHT_2(list, mult, 1);
}
-Obj FuncMULT_ROW_VECTOR_RIGHT_2(Obj self, Obj list, Obj mult)
+Obj FuncMULT_VECTOR_RIGHT_2(Obj self, Obj list, Obj mult)
{
- return MULT_ROW_VECTOR_LEFT_RIGHT_2(list, mult, 0);
+ return MULT_VECTOR_LEFT_RIGHT_2(list, mult, 0);
}
/****************************************************************************
**
-*F FuncMULT_ROW_VECTOR_2_FAST( , , )
+*F FuncMULT_VECTOR_2_FAST( , , )
**
** This function destructively multiplies the entries of by
** It does very little checking
@@ -1598,7 +1598,7 @@ Obj FuncMULT_ROW_VECTOR_RIGHT_2(Obj self, Obj list, Obj mult)
** multiplier
*/
-Obj FuncMULT_ROW_VECTOR_2_FAST( Obj self,
+Obj FuncMULT_VECTOR_2_FAST( Obj self,
Obj list,
Obj mult )
{
@@ -1658,7 +1658,7 @@ Obj FuncPROD_VEC_MAT_DEFAULT( Obj self,
if (res == (Obj)0)
{
res = SHALLOW_COPY_OBJ(vecr);
- CALL_2ARGS(MultRowVectorLeftOp, res, elt);
+ CALL_2ARGS(MultVectorLeftOp, res, elt);
}
else
CALL_3ARGS(AddRowVectorOp, res, vecr, elt);
@@ -1676,7 +1676,7 @@ Obj FuncPROD_VEC_MAT_DEFAULT( Obj self,
*F FuncINV_MAT_DEFAULT
**
** A faster version of InvMat for those matrices for whose rows AddRowVector
-** and MultRowVectorLeft make sense (and might have fast kernel methods)
+** and MultVectorLeft make sense (and might have fast kernel methods)
**
*/
@@ -1777,8 +1777,8 @@ Obj InvMatWithRowVecs( Obj mat, UInt mut)
if (!EQ(x, one))
{
xi = INV(x);
- CALL_2ARGS(MultRowVectorLeftOp, row, xi);
- CALL_2ARGS(MultRowVectorLeftOp, row2, xi);
+ CALL_2ARGS(MultVectorLeftOp, row, xi);
+ CALL_2ARGS(MultVectorLeftOp, row2, xi);
}
/* Clear the entries. We know that we can ignore the entries in rows i..j */
@@ -2234,9 +2234,9 @@ static StructGVarFunc GVarFuncs[] = {
GVAR_FUNC(ADD_ROW_VECTOR_3_FAST, 3, "list1, list2, mult"),
GVAR_FUNC(ADD_ROW_VECTOR_2, 2, "list1, list2"),
GVAR_FUNC(ADD_ROW_VECTOR_2_FAST, 2, "list1, list2"),
- GVAR_FUNC(MULT_ROW_VECTOR_LEFT_2, 2, "list, mult"),
- GVAR_FUNC(MULT_ROW_VECTOR_RIGHT_2, 2, "list, mult"),
- GVAR_FUNC(MULT_ROW_VECTOR_2_FAST, 2, "list, mult"),
+ GVAR_FUNC(MULT_VECTOR_LEFT_2, 2, "list, mult"),
+ GVAR_FUNC(MULT_VECTOR_RIGHT_2, 2, "list, mult"),
+ GVAR_FUNC(MULT_VECTOR_2_FAST, 2, "list, mult"),
GVAR_FUNC(PROD_VEC_MAT_DEFAULT, 2, "vec, mat"),
GVAR_FUNC(INV_MAT_DEFAULT_MUTABLE, 1, "mat"),
GVAR_FUNC(INV_MAT_DEFAULT_SAME_MUTABILITY, 1, "mat"),
@@ -2267,7 +2267,7 @@ static Int InitKernel (
InitHdlrFuncsFromTable( GVarFuncs );
InitFopyGVar( "AddRowVector", &AddRowVectorOp );
- InitFopyGVar("MultRowVectorLeft", &MultRowVectorLeftOp);
+ InitFopyGVar("MultVectorLeft", &MultVectorLeftOp);
InitFopyGVar( "ConvertToMatrixRep", &ConvertToMatrixRep );
diff --git a/src/vec8bit.c b/src/vec8bit.c
index c3b53bda23..5836729994 100644
--- a/src/vec8bit.c
+++ b/src/vec8bit.c
@@ -1631,12 +1631,12 @@ void AddVec8BitVec8BitMultInner( Obj sum,
/****************************************************************************
**
-*F FuncMULT_ROW_VECTOR( , , )
+*F FuncMULT_VECTOR( , , )
**
** In-place scalar multiply
*/
-Obj FuncMULT_ROWVECTOR_VEC8BITS( Obj self, Obj vec, Obj mul)
+Obj FuncMULT_VECTOR_VEC8BITS( Obj self, Obj vec, Obj mul)
{
UInt q;
q = FIELD_VEC8BIT(vec);
@@ -5832,7 +5832,7 @@ static StructGVarFunc GVarFuncs [] = {
GVAR_FUNC(ADD_ROWVECTOR_VEC8BITS_5, 5, "gfqvecl, gfqvecr, mul, from, to"),
GVAR_FUNC(ADD_ROWVECTOR_VEC8BITS_3, 3, "gfqvecl, gfqvecr, mul"),
GVAR_FUNC(ADD_ROWVECTOR_VEC8BITS_2, 2, "gfqvecl, gfqvecr"),
- GVAR_FUNC(MULT_ROWVECTOR_VEC8BITS, 2, "gfqvec, ffe"),
+ GVAR_FUNC(MULT_VECTOR_VEC8BITS, 2, "gfqvec, ffe"),
GVAR_FUNC(POSITION_NONZERO_VEC8BIT, 2, "vec8bit, zero"),
GVAR_FUNC(POSITION_NONZERO_VEC8BIT3, 3, "vec8bit, zero, from"),
GVAR_FUNC(APPEND_VEC8BIT, 2, "vec8bitl, vec8bitr"),
diff --git a/src/vecffe.c b/src/vecffe.c
index 4d3bbaf4b8..469e7a48ec 100644
--- a/src/vecffe.c
+++ b/src/vecffe.c
@@ -734,13 +734,13 @@ Obj FuncADD_ROWVECTOR_VECFFES_3( Obj self, Obj vecL, Obj vecR, Obj mult )
}
/****************************************************************************
**
-*F FuncMULT_ROWVECTOR_VECFFES( , , )
+*F FuncMULT_VECTOR_VECFFES( , , )
**
*/
-static Obj MultRowVectorLeftOp; /* BH changed to static */
+static Obj MultVectorLeftOp; /* BH changed to static */
-Obj FuncMULT_ROWVECTOR_VECFFES( Obj self, Obj vec, Obj mult )
+Obj FuncMULT_VECTOR_VECFFES( Obj self, Obj vec, Obj mult )
{
Obj *ptr;
FFV valM;
@@ -772,10 +772,10 @@ Obj FuncMULT_ROWVECTOR_VECFFES( Obj self, Obj vec, Obj mult )
/* check the characteristic */
if (CHAR_FF(fld) != CHAR_FF(FLD_FFE(mult))) {
mult = ErrorReturnObj(
- "MultRowVector: has different field",
+ "MultVector: has different field",
0L, 0L,
"you can replace via 'return ;'");
- return CALL_2ARGS(MultRowVectorLeftOp, vec, mult);
+ return CALL_2ARGS(MultVectorLeftOp, vec, mult);
}
/* if the multiplier is over a non subfield then redispatch */
@@ -1087,7 +1087,7 @@ static StructGVarFunc GVarFuncs [] = {
GVAR_FUNC(ADD_ROWVECTOR_VECFFES_3, 3, "vecl, vecr, mult"),
GVAR_FUNC(ADD_ROWVECTOR_VECFFES_2, 2, "vecl, vecr"),
- GVAR_FUNC(MULT_ROWVECTOR_VECFFES, 2, "vec, mult"),
+ GVAR_FUNC(MULT_VECTOR_VECFFES, 2, "vec, mult"),
GVAR_FUNC(IS_VECFFE, 1, "vec"),
GVAR_FUNC(COMMON_FIELD_VECFFE, 1, "vec"),
GVAR_FUNC(SMALLEST_FIELD_VECFFE, 1, "vec"),
diff --git a/src/vecgf2.c b/src/vecgf2.c
index 42e42a6914..e06dcbd9d7 100644
--- a/src/vecgf2.c
+++ b/src/vecgf2.c
@@ -2382,11 +2382,11 @@ Obj FuncSUM_GF2VEC_GF2VEC (
/****************************************************************************
**
-*F FuncMULT_ROW_VECTOR_GF2VECS_2( , , )
+*F FuncMULT_VECTOR_GF2VECS_2( , , )
** . . . . . sum of GF2 vectors
**
*/
-Obj FuncMULT_ROW_VECTOR_GF2VECS_2 (
+Obj FuncMULT_VECTOR_GF2VECS_2 (
Obj self,
Obj vl,
Obj mul )
@@ -4503,7 +4503,7 @@ static StructGVarFunc GVarFuncs [] = {
GVAR_FUNC(SHRINKCOEFFS_GF2VEC, 1, "gf2vec"),
GVAR_FUNC(POSITION_NONZERO_GF2VEC, 2, "gf2vec, zero"),
GVAR_FUNC(POSITION_NONZERO_GF2VEC3, 3, "gf2vec, zero, from"),
- GVAR_FUNC(MULT_ROW_VECTOR_GF2VECS_2, 2, "gf2vecl, mul"),
+ GVAR_FUNC(MULT_VECTOR_GF2VECS_2, 2, "gf2vecl, mul"),
GVAR_FUNC(APPEND_GF2VEC, 2, "gf2vecl, gf2vecr"),
GVAR_FUNC(SHALLOWCOPY_GF2VEC, 1, "gf2vec"),
GVAR_FUNC(NUMBER_GF2VEC, 1, "gf2vec"),