ACEsuit / Polynomials4ML.jl

Polynomials for ML: fast evaluation, batching, differentiation
MIT License
12 stars 5 forks source link

Very Strange Bug #48

Closed cortner closed 1 year ago

cortner commented 1 year ago

not sure what else to call this. Maybe a bug in ObjectPools? Maybe in StrideArrays? Maybe in P4ML? For now I'm filing it here. It is VERY disconcerting ...

using Polynomials4ML 
cheb = chebyshev_basis(11)
X = 2 * rand(7) .- 1 
dP = Polynomials4ML.evaluate_d(cheb, X) 
u = randn(11) 
dP[1, :] == (@view dP[1,:])     # true 
dot(dP[1, :], u) == dot((@view dP[1,:]), u)   # false 
dp1 = collect((@view dP[1,:]))
dot((@view dP[1,:]), u) == dot(dp1, u)    # true 
dot((@view dP[1,:]), u) == dot([dP[1,j] for j = 1:11], u)    # true

The @view version gives the correct result. REALLY?!?!?!?

cortner commented 1 year ago

moving this to ObjectPools