The signature product(F::Array{Factor{T,N},1}) where {T,N} requires that N be a defined value for the whole (specialized) method. But in your case you want to allow different N values for different array elements, so you can write:
function product(F::Array{Factor{T,N} where N, 1}) where T
# ... code that uses `T`
end
or equivalently, just leave N unspecified:
function product(F::Array{Factor{T}, 1}) where T
# ... code that uses `T`
end
However, you need to change the body of the method to choose a specific N when you instantiate a Factor.
This will only work when the user has specifically created an Array{Factor{T}, 1}, that is, an array in which every different element can have a potentially different N in its Factor parameters. That’s almost certainly not what you want, because it will fail in some simple cases:
julia> product([A])
ERROR: MethodError: no method matching product(::Array{Factor{Float64,1},1})
You may have intended to import Base.product
Closest candidates are:
product(::Array{Factor{T,N} where N,1}) where T at REPL[4]:1
Stacktrace:
[1] top-level scope at REPL[5]:100:
You almost certainly want:
function product(F::Array{<:Factor{T}, 1}) where {T}
# code that uses `T`
end
which accepts any array whose element type is some subtype of Factor{T}.
Even better, unless you actually care about only accepting the built-in type Array and not any other array-like object, you probably want:
function product(F::AbstractArray{<:Factor{T}, 1}) where {T}
or, exactly equivalently:
function product(F::AbstractVector{<:Factor{T}}) where {T}
since AbstractVector{T} is exactly AbstractArray{T, 1}.
This will only work when the user has specifically created an Array{Factor{T}, 1} , that is, an array in which every different element can have a potentially different N in its Factor parameters.