@@ -10,40 +10,40 @@ class Program
1010 {
1111 static void Main ( string [ ] args )
1212 {
13- Console . WriteLine ( "Efficient matrix multiplication with NumPy:" ) ;
14- // before starting the measurement, let us call numpy once to get the setup checks done.
15- var stopwatch = Stopwatch . StartNew ( ) ;
16- np . arange ( 1 ) ;
13+ Console . WriteLine ( "Efficient matrix multiplication with NumPy:" ) ;
14+ // before starting the measurement, let us call numpy once to get the setup checks done.
15+ np . arange ( 1 ) ;
16+ var stopwatch = Stopwatch . StartNew ( ) ;
1717
18- var a1 = np . arange ( 60000 ) . reshape ( 300 , 200 ) ;
19- var a2 = np . arange ( 80000 ) . reshape ( 200 , 400 ) ;
18+ var a1 = np . arange ( 60000 ) . reshape ( 300 , 200 ) ;
19+ var a2 = np . arange ( 80000 ) . reshape ( 200 , 400 ) ;
2020
21- var result = np . matmul ( a1 , a2 ) ;
22- stopwatch . Stop ( ) ;
21+ var result = np . matmul ( a1 , a2 ) ;
22+ stopwatch . Stop ( ) ;
2323
24- Console . WriteLine ( $ "execution time with NumPy: { stopwatch . Elapsed . TotalMilliseconds } ms\n ") ;
25- Console . WriteLine ( "Result:\n " + result . repr ) ;
24+ Console . WriteLine ( $ "execution time with NumPy: { stopwatch . Elapsed . TotalMilliseconds } ms\n ") ;
25+ Console . WriteLine ( "Result:\n " + result . repr ) ;
2626
2727
28- Console . WriteLine ( "executing on bg thread" ) ;
28+ Console . WriteLine ( "executing on bg thread" ) ;
2929
30- var a = np . arange ( 1000 ) ;
31- var b = np . arange ( 1000 ) ;
30+ var a = np . arange ( 1000 ) ;
31+ var b = np . arange ( 1000 ) ;
3232
33- // https://github.com/pythonnet/pythonnet/issues/109
34- PythonEngine . BeginAllowThreads ( ) ;
33+ // https://github.com/pythonnet/pythonnet/issues/109
34+ PythonEngine . BeginAllowThreads ( ) ;
3535
36- Task . Run ( ( ) =>
37- {
38- using ( Py . GIL ( ) )
39- {
40- np . matmul ( a , b ) ;
41- Console . WriteLine ( "matmul on bg thread is done" ) ;
42- }
43- } ) . Wait ( ) ;
44- Console . WriteLine ( "Press key" ) ;
36+ Task . Run ( ( ) =>
37+ {
38+ using ( Py . GIL ( ) )
39+ {
40+ np . matmul ( a , b ) ;
41+ Console . WriteLine ( "matmul on bg thread is done" ) ;
42+ }
43+ } ) . Wait ( ) ;
44+ Console . WriteLine ( "Press key" ) ;
4545
46- Console . ReadKey ( ) ;
46+ Console . ReadKey ( ) ;
4747 }
4848 }
4949}
0 commit comments