Let $M$ be a real square matrix of order $n\ge 3$.
Assume that for every *nonnegative* vector $\textbf{z}\in \mathbb R^n$ which has at lease one zero entry we have $\textbf{z}^T M \textbf{z} \ge 0$.
Can we deduce that $\textbf{1}^T M \textbf{1}\ge 0$, where $\textbf{1}$ is the all one vector?



A question about the sign of quadratic forms on nonnegative vectors
I think $$M=\pmatrix{5&-3&-3\cr-3&5&-3\cr-3&-3&5\cr}$$ is a counterexample.
If $z=(a,b,0)$, then $z^tMz=5a^2-6ab+5b^2\ge0$ for all $a,b$ (and, by symmetry, the same should be true for $(a,0,b)$ and $(0,a,b)$), but if $z=(1,1,1)$, then $z^tMz=-3<0$.


