The legendary Dark Matrix was a repository of all the dead Time Lords' most evil, twisted and perverted thoughts, created when the Time Lords constructed machinery to filter out any negative or forbidden thoughts from the Matrix. They kept the Dark Matrix in its own APC Net, trapped beneath the Citadel by the Keeper of the Matrix's great key.
The Seventh Doctor confronted the Dark Matrix when the Valeyard — attempting to use its power to give himself a new body — trapped it inside his TARDIS. He "fed" it the energies of the women he killed under his new alias of the Ripper to try to control it. The Doctor provoked the Dark Matrix into destroying the TARDIS and itself by convincing it that it was still a prisoner. (PROSE: Matrix)