Former-commit-id:06a8b51d6d
[formerlya02aeb236c
[formerly9f19e3f712
] [formerly06a8b51d6d
[formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]] Former-commit-id:a02aeb236c
[formerly9f19e3f712
] Former-commit-id:a02aeb236c
Former-commit-id:133dc97f67
32 lines
884 B
Python
Executable file
32 lines
884 B
Python
Executable file
import Scientific_numerics_package_id
|
|
package = Scientific_numerics_package_id.getNumericsPackageName()
|
|
del Scientific_numerics_package_id
|
|
|
|
if package == "Numeric":
|
|
from Numeric import *
|
|
def int_sum(a, axis=0):
|
|
return add.reduce(a, axis)
|
|
def zeros_st(shape, other):
|
|
return zeros(shape, other.typecode())
|
|
array_type = ArrayType
|
|
|
|
elif package == "NumPy":
|
|
|
|
from numpy.oldnumeric import *
|
|
def int_sum(a, axis=0):
|
|
return add.reduce(a, axis)
|
|
def zeros_st(shape, other):
|
|
return zeros(shape, dtype=other.dtype)
|
|
from numpy import ndarray as array_type
|
|
|
|
elif package == "Numarray":
|
|
|
|
from numarray import *
|
|
def int_sum(a, axis=0):
|
|
return add.reduce(a, axis, type=Int)
|
|
def zeros_st(shape, other):
|
|
return zeros(shape, other.typecode())
|
|
|
|
else:
|
|
|
|
raise ImportError("Unknown numerics package " + package)
|