mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2025-01-01 03:40:29 +01:00
groupring_mult! (inplace)
This commit is contained in:
parent
679166114e
commit
2c43984e19
@ -215,13 +215,11 @@ end
|
|||||||
(+)(X::GroupRingElem, Y::GroupRingElem) = add(X,Y)
|
(+)(X::GroupRingElem, Y::GroupRingElem) = add(X,Y)
|
||||||
(-)(X::GroupRingElem, Y::GroupRingElem) = add(X,-Y)
|
(-)(X::GroupRingElem, Y::GroupRingElem) = add(X,-Y)
|
||||||
|
|
||||||
function algebra_multiplication{T<:Number}(X::AbstractVector{T},
|
function groupring_mult!(X,Y,pm,result)
|
||||||
Y::AbstractVector{T}, pm::Array{Int,2})
|
|
||||||
result = zeros(X)
|
|
||||||
for (j,y) in enumerate(Y)
|
for (j,y) in enumerate(Y)
|
||||||
if y != zero(T)
|
if y != zero(eltype(Y))
|
||||||
for (i, index) in enumerate(pm[:,j])
|
for (i, index) in enumerate(pm[:,j])
|
||||||
if X[i] != zero(T)
|
if X[i] != zero(eltype(X))
|
||||||
index == 0 && throw(ArgumentError("The product don't seem to belong to the span of basis!"))
|
index == 0 && throw(ArgumentError("The product don't seem to belong to the span of basis!"))
|
||||||
result[index] += X[i]*y
|
result[index] += X[i]*y
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user