Example #1
0
        public void TestGetColumn()
        {
            ObjectMatrix <int> matrix = GetTestMatrix();

            int columnCount = matrix.Columns;
            int rowCount    = matrix.Rows;

            int[] column = matrix.GetColumn(0);

            Assert.AreEqual(matrix.Columns, columnCount);
            Assert.AreEqual(matrix.Rows, rowCount);

            Assert.AreEqual(column.Length, matrix.Rows);

            for (int i = 0; i < column.Length; i++)
            {
                Assert.AreEqual(column[i], i);
            }

            column = matrix.GetColumn(1);

            Assert.AreEqual(column.Length, matrix.Rows);

            for (int i = 0; i < column.Length; i++)
            {
                Assert.AreEqual(column[i], i + 1);
            }
        }
Example #2
0
        public void GetColumnExample()
        {
            var matrix = new ObjectMatrix <double>(2, 2);

            matrix[0, 0] = 1;
            matrix[0, 1] = 2;
            matrix[1, 0] = 3;
            matrix[1, 1] = 4;

            var column1 = matrix.GetColumn(0);

            Assert.AreEqual(1, column1[0]);
            Assert.AreEqual(3, column1[1]);

            var column2 = matrix.GetColumn(1);

            Assert.AreEqual(2, column2[0]);
            Assert.AreEqual(4, column2[1]);
        }
        public void GetColumnExample()
        {
            var matrix = new ObjectMatrix<double>(2, 2);
            matrix[0, 0] = 1;
            matrix[0, 1] = 2;
            matrix[1, 0] = 3;
            matrix[1, 1] = 4;

            var column1 = matrix.GetColumn(0);

            Assert.AreEqual(1, column1[0]);
            Assert.AreEqual(3, column1[1]);

            var column2 = matrix.GetColumn(1);

            Assert.AreEqual(2, column2[0]);
            Assert.AreEqual(4, column2[1]);
        }
Example #4
0
        public void TestInvalidGetColumn3()
        {
            ObjectMatrix <int> matrix = GetTestMatrix();

            int[] row = matrix.GetColumn(matrix.Columns + 1);
        }