I’m defining an algebra structure on ℝⁿ, i.e. apart from standard (vector) addition I want to multiply vectors. The structure of vector mutliplication is encoded in (Cayley-) table `p_m::Array{Int,2}`

, i.e. `pm[i,j] = k`

when `eᵢ⋅eⱼ = eₖ`

. The full function computing the product is

```
function algebra_multiplication{T<:Number}(X::Vector{T}, Y::Vector{T}, pm::Array{Int,2})
result = zeros(X)
for (i,x) in enumerate(X)
if x != 0
for (j, index) in enumerate(pm[i,:])
if Y[j] != 0
result[index] += x*Y[j]
end
end
end
end
return result
end
```

This works very well for floats:

```
@time algebra_multiplication(D,D,pm);
0.000064 seconds (32 allocations: 56.875 KB)
```

However for arguments of type Rational{Int}, or Rational{BigInt} it is three orders of magnitude slower:

```
0.014855 seconds (54.67 k allocations: 2.264 MB)
0.043915 seconds (447.38 k allocations: 12.445 MB)
```

Is it expected, or should I dig more?