Beispiel #1
0
        public void Linspace_ShouldSucceed()
        {
            VectorXD v = VectorXD.Linespace(1, 10, 10);

            Assert.Equal(10.0, v.Max());
            Assert.Equal(1.0, v.Min());
            Assert.Equal(10, v.Length);
            Assert.Equal(new VectorXD(new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }), v);
        }
Beispiel #2
0
        public void ToString_ShouldSucceed()
        {
            SparseVectorD A = new VectorXD(new double[] { 1, 3, 1 }).ToSparse();

            Assert.Equal("SparseVectorD, 3:\n\n1 3 1", A.ToString());

            var B = new VectorXD(new double[] { 1.3423432, 3.234324, 3243241 }).ToSparse();

            Assert.Equal("SparseVectorD, 3:\n\n1.34 3.23 3.24E+06", B.ToString());

            var C = VectorXD.Linespace(0, 99, 100).ToSparse();

            Assert.Equal("SparseVectorD, 100:\n\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...", C.ToString());
        }