Localized-Density-Matrix Method and Its Application to Carbon Nanotubes