Ejemplo n.º 1
0
        public void Identity_Dimension1_MatriceIdentite1Ligne1Colonne()
        {
            Matrice2D attendue = new Matrice2D(new float[, ]
            {
                { 1 },
            });
            int dimension = 1;

            Matrice2D identite = Matrice2D.Identite(dimension);

            identite.Should().Be(attendue);
        }
Ejemplo n.º 2
0
        public void Identity_Dimension2_MatriceIdentite2Lignes2Colonnes()
        {
            Matrice2D attendue = new Matrice2D(new float[, ]
            {
                { 1, 0 },
                { 0, 1 },
            });
            int dimension = 2;

            Matrice2D identite = Matrice2D.Identite(dimension);

            identite.Should().Be(attendue);
        }
Ejemplo n.º 3
0
        public void OperateurMultiplication_Cas23x32_Matrice22()
        {
            Matrice2D operande1 = new Matrice2D(new float[, ]
            {
                { 1, 2, 0 },
                { 4, 3, -1 },
            });
            Matrice2D operande2 = new Matrice2D(new float[, ]
            {
                { 5, 1 },
                { 2, 3 },
                { 3, 4 },
            });
            Matrice2D resultatAttendu = new Matrice2D(new float[, ]
            {
                { 9, 7 },
                { 23, 9 },
            });

            Matrice2D resultatCalcule = operande1 * operande2;

            resultatCalcule.Should().Be(resultatAttendu);
        }
Ejemplo n.º 4
0
        public void OperateurMultiplication_Cas32x23_Matrice33()
        {
            Matrice2D operande1 = new Matrice2D(new float[, ]
            {
                { 5, 1 },
                { 2, 3 },
                { 3, 4 },
            });
            Matrice2D operande2 = new Matrice2D(new float[, ]
            {
                { 1, 2, 0 },
                { 4, 3, -1 },
            });
            Matrice2D resultatAttendu = new Matrice2D(new float[, ]
            {
                { 9, 13, -1 },
                { 14, 13, -3 },
                { 19, 18, -4 },
            });

            Matrice2D resultatCalcule = operande1 * operande2;

            resultatCalcule.Should().Be(resultatAttendu);
        }