Given two positive definite matrices $A, B \in \Bbb R^{n \times n}$, is there a way to construct a convex function $f: \Bbb R^n \to \Bbb R$ such that $$\nabla^2f(x)=A \qquad \text{and} \qquad \nabla^2f(y)=B$$ for two distinct $x,y \in \Bbb R^n$ (say $x=0_n$, $y=1_n$)?
I've tried the usual suspects (stuff with quadratics, exponentials, etc) without going anywhere.
Let us try to construct an example explicitly as $h(x)=f(g(x))$ where $f\colon\Bbb R\to\Bbb R$ and $g\colon\Bbb R^n\to\Bbb R$. The Hessian of $h$ is $$ \nabla^2 h(x)=f''(g(x))\nabla g(x)\nabla g(x)^T+f'(g(x))\nabla^2 g(x).\tag{1} $$ 1. Define for $T>0$ the function $$ f_T(t)=\begin{cases}\frac{t^2}{T}-\frac{t^3}{3T^2}, & t\le T\\ t-\frac{T}{3}, & t>T.\end{cases} $$ It is straightforward to verify that $f_T\in C^2$, convex and increasing for $t\ge 0$. Furthermore, $$ f_T'(0)=0,\quad f_T''(T)=0,\quad f_T'(T)=1.\tag{2} $$ 2. Define $g(x)=\frac12(x-a)^TB(x-a)$ for a fixed $a\in\Bbb R^n$ and a positive definite $B$. We have $$ \nabla g(x)=B(x-a),\quad\nabla^2 g(x)=B.\tag{3} $$ 3. Set $T=g(b)$ for a fixed $b\in\Bbb R^n$, $b\ne a$. Then $T>0$ and $h_1(x)=f_{g(b)}(g(x))$ is convex (as a composition of convex non-negative $g$ with convex and increasing for non-negative arguments $f$). Moreover, from (1)-(3) we have $$ \nabla^2 h_1(a)=f''(0)\cdot 0+0\cdot B=0,\quad \nabla^2 h_1(b)=0\cdot\nabla g(b)\nabla g(b)^T+1\cdot B=B. $$ 4. Similarly we can construct $h_2(x)$ with $$ \nabla^2 h_2(b)=0,\quad\nabla^2 h_2(a)=A $$ and take $h=h_1+h_2$.