diff --git a/GroupAlgebras.jl b/GroupAlgebras.jl index 4d0a52c..fc0e9b8 100644 --- a/GroupAlgebras.jl +++ b/GroupAlgebras.jl @@ -111,7 +111,17 @@ end length(X::GroupAlgebraElement) = length(X.coefficients) size(X::GroupAlgebraElement) = size(X.coefficients) -norm(X::GroupAlgebraElement, p=2) = norm(X.coefficients, p) + +function norm(X::GroupAlgebraElement, p=2) + if p == 1 + return sum(abs(X.coefficients)) + elseif p == Inf + return max(abs(X.coefficients)) + else + return norm(X.coefficients, p) + end +end + ɛ(X::GroupAlgebraElement) = sum(X.coefficients) rationalize{T<:Integer, S<:Number}(::Type{T}, X::GroupAlgebraElement{S}; @@ -119,5 +129,4 @@ rationalize{T<:Integer, S<:Number}(::Type{T}, X::GroupAlgebraElement{S}; GroupAlgebraElement( rationalize(T, X.coefficients, tol=tol), X.product_matrix) - end