Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why use @views in router.jl line 82 #31

Open
guotie opened this issue Feb 19, 2025 · 0 comments
Open

Why use @views in router.jl line 82 #31

guotie opened this issue Feb 19, 2025 · 0 comments

Comments

@guotie
Copy link

guotie commented Feb 19, 2025

acc += @views dot(Λ, v[c.Ai]) - dot(Δ, v[c.Ai])

    # Objective function
    function fn(v)
        if !all(v .== r.v)
            find_arb!(r, v)
            r.v .= v
        end

        acc = 0.0

        for (Δ, Λ, c) in zip(r.Δs, r.Λs, r.cfmms)
            acc += @views dot(Λ, v[c.Ai]) - dot(Δ, v[c.Ai])   # This line, no varible changed, why use @views?
        end

        return f(r.objective, v) + acc
    end

acc += @views dot(Λ, v[c.Ai]) - dot(Δ, v[c.Ai]) This line, no varibles changed, why use @views?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant