Skip to content

Commit

Permalink
fixup! attempt to make vector and matrix objects official
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Nov 22, 2019
1 parent d418603 commit d62557d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions hpcgap/lib/upolyirr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,17 @@ end;

#############################################################################
##
#F CompanionMat( <poly>
#M CompanionMatrix( <poly> )
#M CompanionMatrix( <coeffs> )
##
InstallGlobalFunction( CompanionMat, function ( arg )

InstallMethod( CompanionMatrix,
[ IsObject ],
function( obj )
local c, l, res, i, F, c1;

# for the moment allow coefficients as well
if not IsList( arg[1] ) then
c := CoefficientsOfLaurentPolynomial( arg[1] );
if not IsList( obj ) then
c := CoefficientsOfLaurentPolynomial( obj );
if c[2] < 0 then
Error( "This polynomial does not have a companion matrix" );
fi;
Expand All @@ -116,7 +118,7 @@ InstallGlobalFunction( CompanionMat, function ( arg )
Append( c1, c[1] );
c:= c1;
else
c := arg[1];
c := obj;
F:= DefaultField( c );
fi;

Expand All @@ -132,6 +134,7 @@ InstallGlobalFunction( CompanionMat, function ( arg )
od;
return res;
end );


#############################################################################
##
Expand Down

0 comments on commit d62557d

Please sign in to comment.