You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry to ask question in the issue page here, but I really have struggled with the problem following for a time and cannot figure it out.
I am trying to use NLsolve to perform least-square-fitting. The kpts acts as xs in normal sense, which is of shape (n, 2) with each row be a point in 2d. The data to be fitted are the eigenvals at those points, which is obtained through dirac_2layer:
functiondirac_1layer(kpts, p)
γ0, V1 = p
eigs =Array{Float64}(undef, 2, size(kpts, 1))
for ik inaxes(eigs, 2)
f =f_gen(vec(kpts[ik, :]))
fc =conj(f)
h11 = [0-γ0*f; -γ0*fc 0]
hpot =diagm([V1, V1])
eigs[:, ik] =eigvals(h11 .+ hpot)
endreturnvec(eigs)
end
Random.seed!(1234)
# - initial values of params -
γ0 =2.5
V10 =-0.097611# - generate testing data -
kpts =rand(100, 2)
ys0 =dirac_1layer(kpts, [γ0, V10])
ys = ys0 .+randn(size(ys0)) .*0.1# - fit -functionresidual!(dy, p)
dy .=dirac_1layer(kpts, p) .- ys
endnlsolve(residual!, [γ0, V10])
The error is like:
In fact, I also have tried the not in-place syntax:
Sorry to ask question in the issue page here, but I really have struggled with the problem following for a time and cannot figure it out.
I am trying to use NLsolve to perform least-square-fitting. The
kpts
acts asxs
in normal sense, which is of shape(n, 2)
with each row be a point in 2d. The data to be fitted are the eigenvals at those points, which is obtained throughdirac_2layer
:The error is like:
![image](https://private-user-images.githubusercontent.com/32637321/400319204-ff3a5e0d-0b94-440b-b658-29d268b01d8e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjQ3MTEsIm5iZiI6MTczOTE2NDQxMSwicGF0aCI6Ii8zMjYzNzMyMS80MDAzMTkyMDQtZmYzYTVlMGQtMGI5NC00NDBiLWI2NTgtMjlkMjY4YjAxZDhlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA1MTMzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI4NzU4ZjhmNzNkNzU2MjY3Y2MwNTA1MGE3MjY4OWRmNGY3ZTA2NGNlOTkwYWUxNzk4MDliODczYzA0NDc1NjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.zLlarSIWRV5L0CB8EIXuPcUGwY0HGFf-lEvI2T0QD9c)
In fact, I also have tried the not in-place syntax:
And the error occur at the same line:
![image](https://private-user-images.githubusercontent.com/32637321/400319519-04aca755-0cda-4aeb-9aba-8bdf8d32b7d8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjQ3MTEsIm5iZiI6MTczOTE2NDQxMSwicGF0aCI6Ii8zMjYzNzMyMS80MDAzMTk1MTktMDRhY2E3NTUtMGNkYS00YWViLTlhYmEtOGJkZjhkMzJiN2Q4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA1MTMzMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZiYjJmYzBmNWIxNmE0ZTQyZGVhZjY3ZjZmOWY0ZjgxOGY2OWM2OWYzY2FmZWVjMGE2ZWFmZjU4OTZlYjQzYzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.9LWCQSwu9PIZgIp2qTgd48iqhBGGbLf_u58bx6KD6PY)
Is there something I am missing here?
The text was updated successfully, but these errors were encountered: