Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/numexpr-2.11.1.dev0-py3.11-linux-x86_64.egg/numexpr/__init__.py: 9%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

23 statements  

1################################################################### 

2# Numexpr - Fast numerical array expression evaluator for NumPy. 

3# 

4# License: MIT 

5# Author: See AUTHORS.txt 

6# 

7# See LICENSE.txt and LICENSES/*.txt for details about copyright and 

8# rights to use. 

9#################################################################### 

10 

11""" 

12Numexpr is a fast numerical expression evaluator for NumPy. With it, 

13expressions that operate on arrays (like "3*a+4*b") are accelerated 

14and use less memory than doing the same calculation in Python. 

15 

16See: 

17 

18https://github.com/pydata/numexpr 

19 

20for more info about it. 

21 

22""" 

23 

24from numexpr.interpreter import __BLOCK_SIZE1__, MAX_THREADS, use_vml 

25 

26is_cpu_amd_intel = False # DEPRECATION WARNING: WILL BE REMOVED IN FUTURE RELEASE 

27 

28# cpuinfo imports were moved into the test submodule function that calls them 

29# to improve import times. 

30 

31from numexpr.expressions import E 

32from numexpr.necompiler import (NumExpr, disassemble, evaluate, re_evaluate, 

33 validate) 

34from numexpr.utils import (_init_num_threads, detect_number_of_cores, 

35 detect_number_of_threads, get_num_threads, 

36 get_vml_version, set_num_threads, 

37 set_vml_accuracy_mode, set_vml_num_threads) 

38 

39# Detect the number of cores 

40ncores = detect_number_of_cores() 

41# Initialize the number of threads to be used 

42nthreads = _init_num_threads() 

43# The default for VML is 1 thread (see #39) 

44# set_vml_num_threads(1) 

45 

46from . import version 

47 

48__version__ = version.version 

49 

50def print_versions(): 

51 """Print the versions of software that numexpr relies on.""" 

52 try: 

53 import numexpr.tests 

54 return numexpr.tests.print_versions() 

55 except ImportError: 

56 # To maintain Python 2.6 compatibility we have simple error handling 

57 raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.') 

58 

59def test(verbosity=1): 

60 """Run all the tests in the test suite.""" 

61 try: 

62 import numexpr.tests 

63 return numexpr.tests.test(verbosity=verbosity) 

64 except ImportError: 

65 # To maintain Python 2.6 compatibility we have simple error handling 

66 raise ImportError('`numexpr.tests` could not be imported, likely it was excluded from the distribution.')