Quicker construction of the fully connected matrix