How can I write a code to update a matrix based on certain rules? I plan on constructing a large matrix, and I cannot submit entries one by one.
The rules for the matrix are as followed:
$$ P(i,j)= \begin{cases} p, & \text{if $j$ = $2i$}\land m \\ q, & \text{if $j$ = $(2i-m)$ }\lor 0 \end{cases} $$
P is square. I was thinking of just defining it to be a 0 matrix first, then updating the values with whatever code. However, I can't seem to think of how that would be done. I've never heard of updating a matrix. For a given $m$, how would one generate such matrix in Mathematica? Could someone list an example?