X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=vendor%2Fgonum.org%2Fv1%2Fgonum%2Fmat%2Fformat_example_test.go;fp=vendor%2Fgonum.org%2Fv1%2Fgonum%2Fmat%2Fformat_example_test.go;h=0000000000000000000000000000000000000000;hp=4dba5ace4525dcd0c20ab9f83fc364ff9dd2affe;hb=54373c1a3efe0e373ec1605840a4363e4b246c46;hpb=ee01d543fdfe1fd0a4d548965c66f7923ea7b062 diff --git a/vendor/gonum.org/v1/gonum/mat/format_example_test.go b/vendor/gonum.org/v1/gonum/mat/format_example_test.go deleted file mode 100644 index 4dba5ace..00000000 --- a/vendor/gonum.org/v1/gonum/mat/format_example_test.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright ©2015 The Gonum Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package mat_test - -import ( - "fmt" - - "gonum.org/v1/gonum/mat" -) - -func ExampleFormatted() { - a := mat.NewDense(3, 3, []float64{1, 2, 3, 0, 4, 5, 0, 0, 6}) - - // Create a matrix formatting value with a prefix and calculating each column - // width individually... - fa := mat.Formatted(a, mat.Prefix(" "), mat.Squeeze()) - - // and then print with and without zero value elements. - fmt.Printf("with all values:\na = %v\n\n", fa) - fmt.Printf("with only non-zero values:\na = % v\n\n", fa) - - // Modify the matrix... - a.Set(0, 2, 0) - - // and print it without zero value elements. - fmt.Printf("after modification with only non-zero values:\na = % v\n\n", fa) - - // Modify the matrix again... - a.Set(0, 2, 123.456) - - // and print it using scientific notation for large exponents. - fmt.Printf("after modification with scientific notation:\na = %.2g\n\n", fa) - // See golang.org/pkg/fmt/ floating-point verbs for a comprehensive list. - - // Output: - // with all values: - // a = ⎡1 2 3⎤ - // ⎢0 4 5⎥ - // ⎣0 0 6⎦ - // - // with only non-zero values: - // a = ⎡1 2 3⎤ - // ⎢. 4 5⎥ - // ⎣. . 6⎦ - // - // after modification with only non-zero values: - // a = ⎡1 2 .⎤ - // ⎢. 4 5⎥ - // ⎣. . 6⎦ - // - // after modification with scientific notation: - // a = ⎡1 2 1.2e+02⎤ - // ⎢0 4 5⎥ - // ⎣0 0 6⎦ -} - -func ExampleExcerpt() { - // Excerpt allows diagnostic display of very large - // matrices and vectors. - - // The big matrix is too large to properly print... - big := mat.NewDense(100, 100, nil) - for i := 0; i < 100; i++ { - big.Set(i, i, 1) - } - - // so only print corner excerpts of the matrix. - fmt.Printf("excerpt big identity matrix: %v\n\n", - mat.Formatted(big, mat.Prefix(" "), mat.Excerpt(3))) - - // The long vector is also too large, ... - long := mat.NewVecDense(100, nil) - for i := 0; i < 100; i++ { - long.SetVec(i, float64(i)) - } - - // ... so print end excerpts of the vector, - fmt.Printf("excerpt long column vector: %v\n\n", - mat.Formatted(long, mat.Prefix(" "), mat.Excerpt(3))) - // or its transpose. - fmt.Printf("excerpt long row vector: %v\n", - mat.Formatted(long.T(), mat.Prefix(" "), mat.Excerpt(3))) - - // Output: - // excerpt big identity matrix: Dims(100, 100) - // ⎡1 0 0 ... ... 0 0 0⎤ - // ⎢0 1 0 0 0 0⎥ - // ⎢0 0 1 0 0 0⎥ - // . - // . - // . - // ⎢0 0 0 1 0 0⎥ - // ⎢0 0 0 0 1 0⎥ - // ⎣0 0 0 ... ... 0 0 1⎦ - // - // excerpt long column vector: Dims(100, 1) - // ⎡ 0⎤ - // ⎢ 1⎥ - // ⎢ 2⎥ - // . - // . - // . - // ⎢97⎥ - // ⎢98⎥ - // ⎣99⎦ - // - // excerpt long row vector: Dims(1, 100) - // [ 0 1 2 ... ... 97 98 99] - -}