begin Matrix2D, Matrix3D, and Matrix4D implementation following the authors lead