CreateColumnMatrix() public static method

Create a matrix that is a single column.
public static CreateColumnMatrix ( double input ) : Matrix
input double A 1D array to make the matrix from.
return Matrix
Example #1
0
        public void Add()
        {
            double[] matrixData = { 1.0, 2.0, 3.0, 4.0 };
            Matrix   matrix     = Matrix.CreateColumnMatrix(matrixData);

            matrix.Add(0, 0, 1);
            Assert.AreEqual(matrix[0, 0], 2.0);
        }
Example #2
0
        public void ColumnMatrix()
        {
            double[] matrixData = { 1.0, 2.0, 3.0, 4.0 };
            Matrix   matrix     = Matrix.CreateColumnMatrix(matrixData);

            Assert.AreEqual(matrix[0, 0], 1.0);
            Assert.AreEqual(matrix[1, 0], 2.0);
            Assert.AreEqual(matrix[2, 0], 3.0);
            Assert.AreEqual(matrix[3, 0], 4.0);
        }
Example #3
0
        public void IsZero()
        {
            double[] matrixData = { 1.0, 2.0, 3.0, 4.0 };
            Matrix   matrix     = Matrix.CreateColumnMatrix(matrixData);

            Assert.IsFalse(matrix.IsZero());
            double[] matrixData2 = { 0.0, 0.0, 0.0, 0.0 };
            Matrix   matrix2     = Matrix.CreateColumnMatrix(matrixData2);

            Assert.IsTrue(matrix2.IsZero());
        }
Example #4
0
        public void IsVector()
        {
            double[] matrixData = { 1.0, 2.0, 3.0, 4.0 };
            Matrix   matrixCol  = Matrix.CreateColumnMatrix(matrixData);
            Matrix   matrixRow  = Matrix.CreateRowMatrix(matrixData);

            Assert.IsTrue(matrixCol.IsVector());
            Assert.IsTrue(matrixRow.IsVector());
            double[][] matrixData2 =
            {
                new[] { 1.0, 2.0 },
                new[] { 3.0, 4.0 }
            };
            var matrix = new Matrix(matrixData2);

            Assert.IsFalse(matrix.IsVector());
        }