@@ -98,18 +98,14 @@ public void MatrixFrom1DArrayIsReference()
9898 [ Test ]
9999 public void DescriptionForMatrixWithRowsButNoColumns ( )
100100 {
101- var matrix = TestMatrices [ "Tall3x2" ] ;
102- matrix = matrix . RemoveColumn ( matrix . ColumnCount - 1 ) ;
103- matrix = matrix . RemoveColumn ( matrix . ColumnCount - 1 ) ;
101+ var matrix = GetMatrixWithRowsButNoColumns ( ) ;
104102 Assert . AreEqual ( "DenseMatrix 3x0-Double\r \n [empty]\r \n [empty]\r \n [empty]\r \n " , matrix . ToString ( ) ) ;
105103 }
106104
107105 [ Test ]
108106 public void DescriptionForMatrixWithColumnsButNoRows ( )
109107 {
110- var matrix = TestMatrices [ "Wide2x3" ] ;
111- matrix = matrix . RemoveRow ( matrix . RowCount - 1 ) ;
112- matrix = matrix . RemoveRow ( matrix . RowCount - 1 ) ;
108+ var matrix = GetMatrixWithColumnsButNoRows ( ) ;
113109 Assert . AreEqual ( "DenseMatrix 0x3-Double\r \n [empty] [empty] [empty]" , matrix . ToString ( ) ) ;
114110 }
115111
@@ -127,6 +123,15 @@ public void DescriptionForMatrixWithNoRowsAndNoColumns()
127123 Assert . AreEqual ( "DenseMatrix 0x0-Double\r \n [empty]" , matrix . ToString ( ) ) ;
128124 }
129125
126+ [ Test ]
127+ public void MatrixMultiplicationWhenMatricesHaveNoRowsAndColumns ( )
128+ {
129+ var a = GetMatrixWithRowsButNoColumns ( ) ;
130+ var b = GetMatrixWithColumnsButNoRows ( ) ;
131+ var result = a * b ;
132+ Assert . AreEqual ( new DenseMatrix ( 3 ) , result ) ;
133+ }
134+
130135 /// <summary>
131136 /// Matrix from two-dimensional array is a copy.
132137 /// </summary>
@@ -241,5 +246,21 @@ public void MatrixToMatrixString()
241246 }
242247 }
243248 }
249+
250+ private Matrix < double > GetMatrixWithRowsButNoColumns ( )
251+ {
252+ var matrix = TestMatrices [ "Tall3x2" ] ;
253+ matrix = matrix . RemoveColumn ( matrix . ColumnCount - 1 ) ;
254+ matrix = matrix . RemoveColumn ( matrix . ColumnCount - 1 ) ;
255+ return matrix ;
256+ }
257+
258+ private Matrix < double > GetMatrixWithColumnsButNoRows ( )
259+ {
260+ var matrix = TestMatrices [ "Wide2x3" ] ;
261+ matrix = matrix . RemoveRow ( matrix . RowCount - 1 ) ;
262+ matrix = matrix . RemoveRow ( matrix . RowCount - 1 ) ;
263+ return matrix ;
264+ }
244265 }
245266}
0 commit comments