I feel really basic, but I cannot figure out how to do it.

For certain formulas I need to multiply each element of a matrix (I know this can be done by using `.`

) But I also need to be able to specify whether to use only columns or rows of a matrix.

So sometimes I need `a[i,j]`

, sometimes I need `a[i,]`

and sometimes `a[,j]`

. I thought I could use `'`

but this flips the matrix diagonally (Its `The conjugate transposition operator`

) and I am not confident that this is what I need to use.

In R the code is

```
F.function = function(i,j,a, B, q, Th){
num = a[i,j] * B[j]^q
den = 1 + sum(Th[,j]*a[,j]*B^q)
return(num/den)
}
```