1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
"""
numarray.ma is a port of Paul Dubois' MA packge for Numeric.
numarray.linear_algebra, numarray.fft, and numarray.random_array are
likewise ports of Numeric's LinearAlgebra, FFT, and RandomArray.
numarray.convolve and numarray.image were created for numarray.
"""
import os, sys
from generate import USE_LAPACK, USE_ABSOFT, normalize, OurExtension
if os.path.exists('/System/Library/Frameworks/vecLib.framework'):
USE_LAPACK = True
if USE_LAPACK:
print "Using external BLAS and LAPACK"
linear_algebra_sourcelist = [
os.path.join('Packages/LinearAlgebra2/Src', 'lapack_litemodule.c'),
]
# Set to list off libraries to link against.
# (only the basenames, e.g. 'lapack'. the library filename will be
# something like liblapack.a, liblapack.so, etc.
# Set to list directories to be searched for BLAS and LAPACK libraries
lapack_compile_args = []
lapack_link_args = []
lapack_include_dirs = ["Packages/LinearAlgebra2/Src"]
if os.path.exists('/System/Library/Frameworks/vecLib.framework'):
# use Apple's optimized BLAS implementation
lapack_libs = []
lapack_link_args = ['-framework', 'vecLib']
lapack_compile_args = ['-framework', 'vecLib']
lapack_dirs = []
lapack_include_dirs += ['/System/Library/Frameworks/vecLib.framework/Headers']
elif USE_ABSOFT: # Absoft Fortran
lapack_dirs = ['/usr/local/lib/atlas', '/opt/absoft/lib']
lapack_libs = ['lapack', 'f77blas', 'cblas', 'atlas',
'f90math', 'fio', 'f77math', 'm']
else:
lapack_dirs = ['/usr/local/lib/atlas']
lapack_include_dirs += ["/usr/local/include/atlas"]
lapack_libs = ['lapack', 'cblas', 'f77blas', 'atlas', 'gfortran', 'm']
lapack_dirs = []
lapack_libs = ['lapack', 'blas', 'gfortran', 'm']
if os.environ.has_key('LINALG_LIB'):
lapack_dirs += [os.environ['LINALG_LIB']]
if os.environ.has_key('LINALG_INCLUDE'):
lapack_include_dirs += [os.environ['LINALG_INCLUDE']]
else:
print "Using builtin 'lite' BLAS and LAPACK"
linear_algebra_sourcelist = [
os.path.join('Packages/LinearAlgebra2/Src', 'lapack_litemodule.c'),
os.path.join('Packages/LinearAlgebra2/Src', 'blas_lite.c'),
os.path.join('Packages/LinearAlgebra2/Src', 'f2c_lite.c'),
os.path.join('Packages/LinearAlgebra2/Src', 'zlapack_lite.c'),
os.path.join('Packages/LinearAlgebra2/Src', 'dlapack_lite.c'),
os.path.join('Packages/LinearAlgebra2/Src', 'dlamch.c')
]
lapack_include_dirs = ["Packages/LinearAlgebra2/Src"]
lapack_libs = []
lapack_dirs = []
if os.path.isfile(os.path.join("Packages/LinearAlgebra2/Src","config.h")):
lapack_compile_args = ['-DHAVE_CONFIG']
else:
lapack_compile_args = []
lapack_link_args = []
ADDONS_DATA_FILES = [('numarray/ma', ['Packages/MA/Legal.htm'])]
ADDONS_PACKAGES = ["numarray.convolve",
"numarray.fft",
"numarray.linear_algebra",
"numarray.random_array",
"numarray.image",
"numarray.nd_image",
"numarray.ma",
"numarray.mlab",
"numarray.matrix",
]
ADDONS_PACKAGE_DIRS = {"numarray.convolve":"Packages/Convolve/Lib",
"numarray.fft": "Packages/FFT2/Lib",
"numarray.linear_algebra":"Packages/LinearAlgebra2/Lib",
"numarray.random_array":"Packages/RandomArray2/Lib",
"numarray.image":"Packages/image/Lib",
"numarray.nd_image":"Packages/nd_image/Lib",
"numarray.ma":"Packages/MA/Lib",
"numarray.mlab":"Packages/mlab/Lib",
"numarray.matrix":"Packages/matrix/Lib",
}
ADDONS_EXTENSIONS = [
OurExtension("numarray.convolve._correlate",
["Packages/Convolve/Src/_correlatemodule.c"]),
OurExtension("numarray.image._combine",
["Packages/image/Src/_combinemodule.c"]),
OurExtension("numarray.nd_image._nd_image",
["Packages/nd_image/Src/nd_image.c",
"Packages/nd_image/Src/ni_filters.c",
"Packages/nd_image/Src/ni_fourier.c",
"Packages/nd_image/Src/ni_interpolation.c",
"Packages/nd_image/Src/ni_measure.c",
"Packages/nd_image/Src/ni_morphology.c",
"Packages/nd_image/Src/ni_support.c"],
include_dirs = ['Packages/nd_image/Src']),
OurExtension("numarray.convolve._lineshape",
["Packages/Convolve/Src/_lineshapemodule.c"]),
OurExtension('numarray.fft.fftpack',
['Packages/FFT2/Src/fftpackmodule.c',
'Packages/FFT2/Src/fftpack.c'],
include_dirs = ['Packages/FFT2/Include']),
OurExtension('numarray.linear_algebra.lapack_lite2',
linear_algebra_sourcelist,
include_dirs = lapack_include_dirs,
library_dirs = lapack_dirs,
libraries = lapack_libs,
extra_compile_args = lapack_compile_args,
extra_link_args = lapack_link_args ),
OurExtension("numarray.random_array.ranlib2",
["Packages/RandomArray2/Src/ranlib.c",
"Packages/RandomArray2/Src/ranlibmodule.c",
"Packages/RandomArray2/Src/com.c",
"Packages/RandomArray2/Src/linpack.c"])
]
# Define this here because it needs all the lapack libraries
if USE_LAPACK:
ADDONS_EXTENSIONS.append(
OurExtension('numarray._dotblas',
['Src/_dotblas.c'],
include_dirs = lapack_include_dirs,
library_dirs = lapack_dirs,
libraries = lapack_libs,
extra_link_args = lapack_link_args )
)
|