Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename MultRowVector to MultVector #2709

Merged
merged 2 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/ref/obsolete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ Here are some further name changes.
<Item><C>MutableNullMat</C></Item>
<Item><Ref Func="NullMat"/></Item>
</Row>
<Row>
<Item><C>MultRowVector</C></Item>
<Item><Ref Oper="MultVectorLeft"/></Item>
</Row>
</Table>


Expand All @@ -185,6 +189,11 @@ Instead of <C>PositionFirstComponent(list,obj)</C>, you may use
<C>PositionProperty(list,x->x[1]=obj)</C> as a replacement, depending on
your specific use case.

<Index Key="MultRowVector"><C>MultRowVector</C></Index>
The five argument version of the operation <C>MultRowVector</C> has been
deprecated in GAP 4.10 since it was unused and only available for coefficient
lists.
Note that <C>MultRowVector</C> was also renamed to <C>MultVectorLeft</C>.

<ManSection>
<InfoClass Name="InfoObsolete"/>
Expand Down
2 changes: 1 addition & 1 deletion doc/ref/vector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ than the <Q>natural</Q> field of the problem.
<#Include Label="[1]{listcoef}">
<#Include Label="AddRowVector">
<#Include Label="AddCoeffs">
<#Include Label="MultRowVector">
<#Include Label="MultVector">
<#Include Label="CoeffsMod">

</Section>
Expand Down
2 changes: 1 addition & 1 deletion hpcgap/lib/ffeconway.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions hpcgap/lib/polyrat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -943,19 +943,19 @@ BindGlobal("RPGcdRepresentationModPrime",function(f,g,p)
# convert <s> and <x> 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]);
Expand Down
6 changes: 3 additions & 3 deletions hpcgap/lib/vec8bit.gi
Original file line number Diff line number Diff line change
Expand Up @@ -583,15 +583,15 @@ InstallOtherMethod( AddRowVector, "For 2 8 bit vectors",

#############################################################################
##
#M MultRowVector( <vec>, <ffe> )
#M MultVector( <vec>, <ffe> )
##
## multiply <vec> by <ffe> 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);

#############################################################################
##
Expand Down
10 changes: 5 additions & 5 deletions hpcgap/lib/vecmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1809,13 +1809,13 @@ end);

#############################################################################
##
#M MultRowVector( <vl>, <mul>)
#M MultVector( <vl>, <mul>)
##

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);

#############################################################################
##
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/claspcgs.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/ffeconway.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/grpffmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
27 changes: 13 additions & 14 deletions lib/listcoef.gd
Original file line number Diff line number Diff line change
Expand Up @@ -97,30 +97,29 @@ DeclareOperation(

#############################################################################
##
#O MultRowVector( <list1>, <poss1>, <list2>, <poss2>, <mul> )
#O MultRowVector( <list>, <mul> )
#O MultVectorLeft( <list>, <mul> )
##
## <#GAPDoc Label="MultRowVector">
## <#GAPDoc Label="MultVector">
## <ManSection>
## <Oper Name="MultRowVector" Arg='list1, [poss1, list2, poss2, ]mul'/>
## <Oper Name="MultVector" Arg='list1, mul'/>
## <Oper Name="MultVectorLeft" Arg='list1, mul'/>
## <Returns>nothing</Returns>
##
## <Description>
## The five argument version of this operation replaces
## <A>list1</A><C>[</C><A>poss1</A><C>[</C><M>i</M><C>]]</C> by
## <C><A>mul</A>*<A>list2</A>[<A>poss2</A>[</C><M>i</M><C>]]</C> for <M>i</M>
## between <M>1</M> and <C>Length( <A>poss1</A> )</C>.
## This operation calculates <A>mul</A>*<A>list1</A> in-place.
## <P/>
## The two-argument version simply multiplies each element of <A>list1</A>,
## in-place, by <A>mul</A>.
## Note that <C>MultVector</C> is just a synonym for
## <C>MultVectorLeft</C>.
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareOperation(
"MultRowVector",
[ IsMutable and IsList,
IsList, IsList, IsList, IsMultiplicativeElement ] );

"MultVectorLeft",
[ IsMutable and IsList,
IsObject ] );
# For VectorObj objects there also exists a MultVectorRight operation
DeclareSynonym( "MultVector", MultVectorLeft );

#############################################################################
##
Expand Down
73 changes: 22 additions & 51 deletions lib/listcoef.gi
Original file line number Diff line number Diff line change
Expand Up @@ -262,73 +262,44 @@ end );

#############################################################################
##
#M MultRowVector( <list1>, <poss1>, <list2>, <poss2>, <mult> )
#M MultVectorLeft( <list>, <mul> )
##
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( <list>, <mul> )
##
InstallOtherMethod( MultRowVector,
"two argument generic method",
true,
InstallMethod( MultVectorLeft,
"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( MultVectorLeft, "error if immutable",
[ IsList, IsObject ],
L1_IMMUTABLE_ERROR);

InstallOtherMethod( MultRowVector,
"Two argument kernel method for small list",
InstallMethod( MultVectorLeft,
"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_VECTOR_LEFT_2
);

InstallOtherMethod( MultRowVector,
"Two argument kernel method for plain list of cyclotomics and an integer",
InstallMethod( MultVectorLeft,
"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_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( 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_VECTOR_VECFFES );


#############################################################################
Expand Down
45 changes: 45 additions & 0 deletions lib/matobj.gi
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,51 @@ InstallMethod( Randomize,
od;
end );

############################################################################
# Arithmetical operations:
############################################################################
InstallMethod( MultVectorLeft,
"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( MultVectorRight,
"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( MultVectorLeft,
"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( MultVectorRight,
"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.
#
Expand Down
Loading