Regular subgroups, nilpotent algebras and projectively congruent matrices