mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-12-25 02:15:29 +01:00
workaround norm(vector,p) type-instability (p=1, Inf)
This commit is contained in:
parent
73500f4931
commit
239521f159
@ -111,7 +111,17 @@ end
|
|||||||
|
|
||||||
length(X::GroupAlgebraElement) = length(X.coefficients)
|
length(X::GroupAlgebraElement) = length(X.coefficients)
|
||||||
size(X::GroupAlgebraElement) = size(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)
|
ɛ(X::GroupAlgebraElement) = sum(X.coefficients)
|
||||||
|
|
||||||
rationalize{T<:Integer, S<:Number}(::Type{T}, X::GroupAlgebraElement{S};
|
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(
|
GroupAlgebraElement(
|
||||||
rationalize(T, X.coefficients, tol=tol), X.product_matrix)
|
rationalize(T, X.coefficients, tol=tol), X.product_matrix)
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user