At first glance it appears Octave matrices are born Double precision float even if all entries are integers. You may need to invoke int32 conversion.
...