I have seen many answers to the converse question (which seems to be difficult in general), but I would like to ask the following:


Let $T: L^2 \rightarrow L^2$ be a trace-class operator that is also an integral operator 


$$Tf = \int K(\cdot,y)f(y)dy.$$


Since $T$ is trace-class $\operatorname{tr}(T)$ exists. Now, I would like to ask: Under what conditions is this trace given by 


$$\operatorname{tr}(T)=\int K(x,x) dx.$$


In a way, continuity would presumably be a sufficient requirement to make sense out of this expression, but I could imagine that much more is known about this.



Trace of integral trace-class operator
As js21 says in the comnent, this is always the case if we understand a restriction $K(x,x)$ of the kernel $K(x,y)$ onto diagonal in appropriate way. In general, a square-summable function of two variables does not have a well-defined restriction to sets of zero measure, like diagonal. But the kernels of nuclear operators belong to a nice class of functions for which integrals against many singular measures, including the diagonal measure, are well-defined.  

It is defined by [Kellerer](https://link.springer.com/article/10.1007/BF00532047) 
and recently studied from a different point of view in a series of papers of Vershik, Zatitskiy and myself. We called such functions 'virtually continuous', since an equivalent description is the following: there exist a set of full measure $X'\subset (X,\mu)$ and a certain separable metric $\rho$ on $X'$ (such that measure $\mu$ is Borel) for which $K(x,y)$ is equivalent to a continuous function on $(X',\rho)$. That is, the virtual continuity is defined without referring to any topology, but using only the measure and the direct product structure of the space. Our paper in [Russian Mathematical Surveys](http://iopscience.iop.org/article/10.1070/RM2014v069n06ABEH004927/meta) contains the details on nuclear operators and virtual continuity, and the further paper in [St. Petersburg Mathematical Journal](http://www.ams.org/journals/spmj/2016-27-03/S1061-0022-2016-01394-6/) explains the connection with another approach to the trace via averaging over the neighborhood of a diagonal.


