a naive matrix implemention