Layout design by matrix