From 63b4a0594f907a03fa9074c858d8ccd09c9e6b64 Mon Sep 17 00:00:00 2001 From: kalmar Date: Mon, 10 Jul 2017 19:29:53 +0200 Subject: [PATCH] Revert "add mul! and addeq! for MatrixSpace construction" This reverts commit 5fb131c39009003acdccc755cb62fa968cb5a93f. --- src/GroupRings.jl | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 20703e7..c5573f2 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -1,7 +1,7 @@ module GroupRings using Nemo -import Nemo: Group, GroupElem, Ring, RingElem, parent, elem_type, parent_type, mul!, addeq! +import Nemo: Group, GroupElem, Ring, RingElem, parent, elem_type, parent_type import Base: convert, show, hash, ==, +, -, *, //, /, length, norm, rationalize, deepcopy_internal, getindex, setindex!, eltype, one, zero @@ -285,13 +285,6 @@ end # ############################################################################### -function addeq!{T}(X::GroupRingElem{T}, Y::GroupRingElem{T}) - parent(X) == parent(Y) || throw(ArgumentError( - "Elements don't seem to belong to the same Group Ring!")) - X.coeffs .+= Y.coeffs - return X -end - function add{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T}) parent(X) == parent(Y) || throw(ArgumentError( "Elements don't seem to belong to the same Group Ring!")) @@ -309,7 +302,7 @@ end (+)(X::GroupRingElem, Y::GroupRingElem) = add(X,Y) (-)(X::GroupRingElem, Y::GroupRingElem) = add(X,-Y) -function mul!{T}(X::AbstractVector{T}, Y::AbstractVector{T}, +function mul!{T<:Number}(X::AbstractVector{T}, Y::AbstractVector{T}, pm::Array{Int,2}, result::AbstractVector{T}) for (j,y) in enumerate(Y) if y != zero(eltype(Y)) @@ -323,11 +316,6 @@ function mul!{T}(X::AbstractVector{T}, Y::AbstractVector{T}, end end -function mul!(result::GroupRingElem, X::GroupRingElem, Y::GroupRingElem) - mul!(X.coeffs, Y.coeffs, parent(X).pm, result.coeffs) - return result -end - function mul{T<:Number}(X::AbstractVector{T}, Y::AbstractVector{T}, pm::Array{Int,2}) result = zeros(X) @@ -337,8 +325,8 @@ end function mul(X::AbstractVector, Y::AbstractVector, pm::Array{Int,2}) T = promote_type(eltype(X), eltype(Y)) - result = zeros(T, X) - mul!(Vector{T}(X), Vector{T}(Y), pm, result) + result = zeros(T, deepcopy(X)) + mul!(X, Y, pm, result) return result end