Example #1
0
 public void DiagonalDenseMatrixMultiplication_IssueCP5706()
 {
     Matrix <double> diagonal = DiagonalMatrix.Identity(3);
     Matrix <double> dense    = DenseMatrix.OfArray(new double[, ] {
         { 1, 2, 3 }, { 1, 2, 3 }, { 1, 2, 3 }
     });
     var test  = diagonal * dense;
     var test2 = dense * diagonal;
 }
Example #2
0
        public void CanCreateIdentity()
        {
            var matrix = DiagonalMatrix.Identity(5);

            for (var i = 0; i < matrix.RowCount; i++)
            {
                for (var j = 0; j < matrix.ColumnCount; j++)
                {
                    Assert.AreEqual(i == j ? Complex32.One : Complex32.Zero, matrix[i, j]);
                }
            }
        }
Example #3
0
 public void IdentityWithWrongOrderThrowsArgumentOutOfRangeException([Values(0, -1)] int order)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => DiagonalMatrix.Identity(order));
 }
 public void IdentityFailsWithZeroOrNegativeOrder(int order)
 {
     DiagonalMatrix.Identity(order);
 }