# Convexity of element-wise matrix product

Say that a function $\,f: \mathbb{R}^{n\times n} \to \mathbb{R}$ is given in an element-wise form as

$$f(A) = \sum_{i,j} A_{ij} F_{ij}.$$

When is this function convex on the whole set $\mathbb{R}^{n\times n}$?

While trying to find an answer to this question I've stumbled upon a definition of quadratic forms based on matrices, where the condition for convexity is straightforward: $f$ is convex if and only if $F$ (the matrix defining the quadratic form element-wise) is positive semi-definite. Is there a correspondence with the case of a more general matrix function like above?

$f$ is convex for all $F$ as $f(A)$ is linear in $A$.
$f(\theta A+(1-\theta)B)=\sum_{ij}(\theta A_{ij}+(1-\theta)B_{ij})F_{ij}=\theta\sum_{ij} A_{ij} F_{ij}+(1-\theta)\sum_{ij}B_{ij}F_{ij}=\theta f(A)+(1-\theta)f(B)$