Added ternaryInit to PolyRingMatrix