scott density and recurrence matrix