generate triangle matrix