Logical or? #328
Logical or?
#328
-
Trying to nll_delta = 0
@turbo for b in 1:B
eq = b==r || b==s
t1 = -E[r,b] * log(E[r,b] / (E_s_r * E_sums[b]))
t1 = ifelse(E[r, b]==0, 0.0, ifelse(eq, t1/2, t1))
t2 = -E[s,b] * log(E[s,b] / (E_s_s * E_sums[b]))
t2 = ifelse(E[s, b]==0, 0.0, ifelse(eq, t2/2, t2))
nll_delta += t1 + t2
end Getting
I'm thinking I can nest even more |
Beta Was this translation helpful? Give feedback.
Answered by
chriselrod
Aug 25, 2021
Replies: 1 comment 2 replies
-
eq = (b == r) | (b == s) Note that the parenthesis are needed, because |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
deklanw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that the parenthesis are needed, because
|
has difference precedence from||
.