matrix skeleton
2d to 1d method added