Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
41 changes: 41 additions & 0 deletions lib/matobj.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1878,6 +1878,47 @@
end );


############################################################################

InstallMethod( AddMatrixRight, "for a mutable matrix object, a matrix object and a scalar",
[ IsMatrixOrMatrixObj and IsMutable, IsMatrixOrMatrixObj, IsObject ],
function( dstmat, srcmat, scalar )
local i, j;
# Assert(0, NrRows(dstmat) = NrRows(srcmat));
# Assert(0, NrCols(dstmat) = NrCols(srcmat));
for i in [1..NrRows(dstmat)] do
for j in [1..NrCols(dstmat)] do
dstmat[i,j] := dstmat[i,j] + srcmat[i,j] * scalar;
od;
od;

Check warning on line 1893 in lib/matobj.gi

View check run for this annotation

Codecov / codecov/patch

lib/matobj.gi#L1889-L1893

Added lines #L1889 - L1893 were not covered by tests
end );

InstallEarlyMethod( AddMatrixRight,
function( dstmat, srcmat, scalar )
local i;
if IsPlistRep(dstmat) and IsPlistRep(srcmat) then

Check warning on line 1899 in lib/matobj.gi

View check run for this annotation

Codecov / codecov/patch

lib/matobj.gi#L1899

Added line #L1899 was not covered by tests
# Assert(0, NrRows(dstmat) = NrRows(srcmat));
# Assert(0, NrCols(dstmat) = NrCols(srcmat));
for i in [1..NrRows(dstmat)] do
AddRowVector(dstmat[i], srcmat[i], scalar);
od;

Check warning on line 1904 in lib/matobj.gi

View check run for this annotation

Codecov / codecov/patch

lib/matobj.gi#L1902-L1904

Added lines #L1902 - L1904 were not covered by tests
else
TryNextMethod();
fi;

Check warning on line 1907 in lib/matobj.gi

View check run for this annotation

Codecov / codecov/patch

lib/matobj.gi#L1906-L1907

Added lines #L1906 - L1907 were not covered by tests
end );

InstallMethod( AddMatrixRight, "for a mutable 8bit matrix, an 8bit matrix and a scalar",
[ Is8BitMatrixRep and IsMutable, Is8BitMatrixRep, IsFFE ],
function( dstmat, srcmat, scalar )
local i, j;
# Assert(0, NrRows(dstmat) = NrRows(srcmat));
# Assert(0, NrCols(dstmat) = NrCols(srcmat));
for i in [1..NrRows(dstmat)] do
ADD_COEFFS_VEC8BIT_3(dstmat[i], srcmat[i], scalar);
od;

Check warning on line 1918 in lib/matobj.gi

View check run for this annotation

Codecov / codecov/patch

lib/matobj.gi#L1916-L1918

Added lines #L1916 - L1918 were not covered by tests
end );


############################################################################
## Fallback method for DeterminantMatrix
InstallMethod(DeterminantMatrix, ["IsMatrixObj"],
Expand Down
21 changes: 21 additions & 0 deletions lib/matobj2.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2052,3 +2052,24 @@ DeclareOperationKernel( "SwapMatrixRows", [ IsMatrixOrMatrixObj and IsMutable, I
## <#/GAPDoc>
##
DeclareOperationKernel( "SwapMatrixColumns", [ IsMatrixOrMatrixObj and IsMutable, IsInt, IsInt ], SWAP_MAT_COLS );


############################################################################
##
##
##
DeclareOperation( "AddMatrixRight", [ IsMatrixOrMatrixObj and IsMutable, IsMatrixOrMatrixObj, IsObject ] );
#DeclareOperation( "AddMatrixLeft", [ IsMatrixOrMatrixObj and IsMutable, IsMatrixOrMatrixObj, IsObject ] );

# TODO: which default, left or right?
#DeclareSynonym( "AddMatrix", AddMatrixRowsLeft);

############################################################################
##
##
##
#DeclareOperation( "MultMatrixRight", [ IsMatrixOrMatrixObj and IsMutable, IsMatrixOrMatrixObj, IsObject ] );
#DeclareOperation( "MultMatrixLeft", [ IsMatrixOrMatrixObj and IsMutable, IsMatrixOrMatrixObj, IsObject ] );

# TODO: which default, left or right?
#DeclareSynonym( "MultMatrix", MultMatrixLeft);
Loading