Rename all beamforming to lasp. In all source code.

This commit is contained in:
Anne de Jong 2018-02-23 20:40:45 +01:00 committed by Anne de Jong
parent 49bc02ed16
commit c55d3b1e17
44 changed files with 268 additions and 269 deletions

7
.gitignore vendored
View File

@ -2,15 +2,14 @@
CMakeFiles
CMakeCache.txt
cmake_install.cmake
Beamforming.egg-info
beamforming/*.cpp
lasp/*.cpp
Makefile
build
*.html
__pycache__
cython_debug
beamforming/config.pxi
beamforming/wrappers.c
lasp/config.pxi
lasp/wrappers.c
*.so
test/test_bf
test/test_fft

View File

@ -2,47 +2,47 @@ cmake_minimum_required (VERSION 3.0)
project(beamforming)
# Whether we want to use blas yes or no
set(ASCEE_USE_BLAS TRUE)
# set(ASCEE_USE_BLAS FALSE)
set(LASP_USE_BLAS TRUE)
# set(LASP_USE_BLAS FALSE)
set(ASCEE_FLOAT double)
# set(ASCEE_FLOAT float)
set(LASP_FLOAT double)
# set(LASP_FLOAT float)
add_definitions(-DASCEE_PARALLEL)
add_definitions(-DASCEE_MAX_NUM_THREADS=8)
add_definitions(-DLASP_PARALLEL)
add_definitions(-DLASP_MAX_NUM_THREADS=8)
add_definitions(-DASCEE_MAX_NUM_CHANNELS=80)
add_definitions(-DLASP_MAX_NUM_CHANNELS=80)
# Reasonable maximum to the nfft size, at 48kHz this is 700s of data..
add_definitions(-DASCEE_MAX_NFFT=33554432) # 2**25
add_definitions(-DLASP_MAX_NFFT=33554432) # 2**25
# ####################################### End of user-adjustable variables section
add_definitions(-D_REENTRANT)
if(ASCEE_FLOAT STREQUAL "double")
add_definitions(-DASCEE_FLOAT=64)
add_definitions(-DASCEE_DOUBLE_PRECISION)
if(LASP_FLOAT STREQUAL "double")
add_definitions(-DLASP_FLOAT=64)
add_definitions(-DLASP_DOUBLE_PRECISION)
else()
add_definitions(-DASCEE_FLOAT=32)
endif(ASCEE_FLOAT STREQUAL "double")
add_definitions(-DLASP_FLOAT=32)
endif(LASP_FLOAT STREQUAL "double")
if(NOT DEFINED ASCEE_DEBUG)
message(SEND_ERROR "ASCEE_DEBUG flag not defined. Please set -DASCEE_DEBUG=TRUE or -DASCEE_DEBUG=FALSE")
endif(NOT DEFINED ASCEE_DEBUG)
if(NOT DEFINED LASP_DEBUG)
message(SEND_ERROR "LASP_DEBUG flag not defined. Please set -DLASP_DEBUG=TRUE or -DLASP_DEBUG=FALSE")
endif(NOT DEFINED LASP_DEBUG)
# ##################### END Cmake variables converted to a macro
set(Python_ADDITIONAL_VERSIONS "3")
# #################### Setting definitions and debug-specific compilation flags
if(ASCEE_DEBUG)
set(TRACERNAME ASCEETracer)
if(LASP_DEBUG)
set(TRACERNAME LASPTracer)
set(CMAKE_BUILD_TYPE Debug)
message("Building debug code")
set(CMAKE_BUILD_TYPE Debug)
add_definitions(-DASCEE_DEBUG=1)
add_definitions(-DLASP_DEBUG=1)
add_definitions(-DTRACERNAME=${TRACERNAME})
add_definitions(-DDEBUG)
add_definitions(-DTRACER=1)
@ -63,7 +63,7 @@ else()
# set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--gc-sections")
add_definitions(-DTRACER=0 -DNDEBUG)
endif(ASCEE_DEBUG)
endif(LASP_DEBUG)
# The last argument here takes care of calling SIGABRT when an integer overflow
# occures.
@ -84,11 +84,11 @@ set(CMAKE_C_FLAGS_RELEASE "-O2 -mfpmath=sse -march=x86-64 -mtune=native \
# set(CMAKE_C_FLAGS_RELEASE "-O2 -march=native -mtune=native -fomit-frame-pointer")
if(ASCEE_USE_BLAS)
add_definitions(-DASCEE_USE_BLAS=1)
if(LASP_USE_BLAS)
add_definitions(-DLASP_USE_BLAS=1)
else()
add_definitions(-DASCEE_USE_BLAS=0)
endif(ASCEE_USE_BLAS)
add_definitions(-DLASP_USE_BLAS=0)
endif(LASP_USE_BLAS)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(win32 true)
@ -109,9 +109,9 @@ endif(DEFINED NUMPY_INCLUDE)
add_subdirectory(fftpack)
include_directories(
fftpack
beamforming/c
lasp/c
)
add_subdirectory(beamforming)
add_subdirectory(lasp)
add_subdirectory(test)
find_program(PYTHON "python")
@ -119,7 +119,7 @@ find_program(PYTHON "python")
if (PYTHON)
# set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/beamforming/*.py")
set(DEPS "${CMAKE_CURRENT_SOURCE_DIR}/lasp/*.py")
set(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")
# configure_file(${SETUP_PY_IN} ${SETUP_PY})

View File

@ -8,7 +8,7 @@ extern "C" {
#endif
#define NPY_VISIBILITY_HIDDEN
#ifdef ASCEE_DOUBLE_PRECISION
#ifdef LASP_DOUBLE_PRECISION
#define Treal double
#else
#define Treal float

View File

@ -15,4 +15,4 @@ include_directories(
set_source_files_properties(wrappers.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} ${CYTHON_EXTRA_C_FLAGS}")
cython_add_module(wrappers wrappers.pyx)
target_link_libraries(wrappers beamforming_lib )
target_link_libraries(wrappers lasp_lib )

View File

@ -1,23 +1,23 @@
if(!ASCEE_DEBUG)
# SET_SOURCE_FILES_PROPERTIES(si_lpn.c PROPERTIES COMPILE_FLAGS -O3)
# SET_SOURCE_FILES_PROPERTIES(si_math.c PROPERTIES COMPILE_FLAGS -O3)
endif(!ASCEE_DEBUG)
if(!LASP_DEBUG)
# SET_SOURCE_FILES_PROPERTIES(y.c PROPERTIES COMPILE_FLAGS -O3)
# SET_SOURCE_FILES_PROPERTIES(x.c PROPERTIES COMPILE_FLAGS -O3)
endif(!LASP_DEBUG)
add_library(beamforming_lib
fft.c
ascee_math.c
ascee_math_raw.c
ascee_alg.c
ascee_assert.c
ascee_tracer.c
window.c
aps.c
ps.c
mq.c
worker.c
dfifo.c
filterbank.c
add_library(lasp_lib
lasp_fft.c
lasp_math.c
lasp_math_raw.c
lasp_alg.c
lasp_assert.c
lasp_tracer.c
lasp_window.c
lasp_aps.c
lasp_ps.c
lasp_mq.c
lasp_worker.c
lasp_dfifo.c
lasp_filterbank.c
)
target_link_libraries(beamforming_lib fftpack openblas)
target_link_libraries(lasp_lib fftpack openblas)

View File

@ -1,11 +1,11 @@
// ascee_alg.c
// lasp_alg.c
//
// Author: J.A. de Jong -ASCEE
//
// Description:
// (Linear) algebra routine implementations
//////////////////////////////////////////////////////////////////////
#include "ascee_alg.h"
#include "lasp_alg.h"
@ -15,7 +15,7 @@ void cmv_dot(const cmat* A,const vc* restrict x,vc* restrict b){
dbgassert(A->n_rows == b->size,SIZEINEQUAL);
dbgassert(A->n_cols == x->size,SIZEINEQUAL);
#if ASCEE_USE_BLAS == 1
#if LASP_USE_BLAS == 1
dbgassert(false,"Untested function");
/* typedef enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102} CBLAS_ORDER; */
/* typedef enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113, CblasConjNoTrans=114} CBLAS_TRANSPOSE; */
@ -108,7 +108,7 @@ lapack_int LAPACKE_zgels( int matrix_layout, char trans, lapack_int m,
#if ASCEE_FLOAT == 64
#if LASP_FLOAT == 64
#define lapack_gelss LAPACKE_zgelss
#define lapack_gels LAPACKE_zgels

View File

@ -1,4 +1,4 @@
// ascee_alg.h
// lasp_alg.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,9 +6,9 @@
// (Linear) algebra routines on matrices and vectors
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ASCEE_ALG_H
#define ASCEE_ALG_H
#include "ascee_math.h"
#ifndef LASP_ALG_H
#define LASP_ALG_H
#include "lasp_math.h"
/**
* Compute the dot product of two vectors of floats
@ -185,5 +185,5 @@ d cmat_normdiff(const cmat* A,const cmat* B);
*/
void kronecker_product(const cmat* a,const cmat* b,cmat* result);
#endif // ASCEE_ALG_H
#endif // LASP_ALG_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// ascee_alloc.h
// lasp_alloc.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,10 +6,10 @@
// memory allocation functions.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ASCEE_ALLOC_H
#define ASCEE_ALLOC_H
#ifndef LASP_ALLOC_H
#define LASP_ALLOC_H
#include <malloc.h>
#include "ascee_tracer.h"
#include "lasp_tracer.h"
/**
* Reserved words for memory allocation. Can be changed to something
* else when required. For example for debugging purposes.
@ -24,5 +24,5 @@ static inline void* a_malloc(size_t nbytes) {
#define a_free free
#define a_realloc realloc
#endif // ASCEE_ALLOC_H
#endif // LASP_ALLOC_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// aps.c
// lasp_aps.c
//
// Author: J.A. de Jong -ASCEE
//
@ -6,10 +6,10 @@
//
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-5)
#include "aps.h"
#include "ps.h"
#include "ascee_alg.h"
#include "dfifo.h"
#include "lasp_aps.h"
#include "lasp_ps.h"
#include "lasp_alg.h"
#include "lasp_dfifo.h"
/* Multiplication factor for the maximum size of the fifo queue. This
* factor is multiplied by nfft to obtain the maximum size of the
@ -65,7 +65,7 @@ AvPowerSpectra* AvPowerSpectra_alloc(const us nfft,
fsTRACE(15);
/* Check nfft */
if(nfft==0 || nfft % 2 != 0 || nfft > ASCEE_MAX_NFFT) {
if(nfft==0 || nfft % 2 != 0 || nfft > LASP_MAX_NFFT) {
WARN("Invalid nfft");
feTRACE(15);
return NULL;

View File

@ -6,11 +6,11 @@
//
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef APS_H
#define APS_H
#include "types.h"
#include "ascee_math.h"
#include "window.h"
#ifndef LASP_APS_H
#define LASP_APS_H
#include "lasp_types.h"
#include "lasp_math.h"
#include "lasp_window.h"
typedef struct AvPowerSpectra_s AvPowerSpectra;
@ -74,5 +74,5 @@ cmat* AvPowerSpectra_addTimeData(AvPowerSpectra* aps,
void AvPowerSpectra_free(AvPowerSpectra*);
#endif // APS_H
#endif // LASP_APS_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,16 +1,16 @@
// ascee_assert.c
// lasp_assert.c
//
// Author: J.A. de Jong -ASCEE
//
// Description:
//
//////////////////////////////////////////////////////////////////////
#include "ascee_assert.h"
#include "lasp_assert.h"
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
#include <stdlib.h>
#include <stdio.h>
#include "types.h"
#include "lasp_types.h"
#define MAX_MSG 200
void DBG_AssertFailedExtImplementation(const char* filename,

View File

@ -1,4 +1,4 @@
// dfifo.c
// lasp_dfifo.c
//
// Author: J.A. de Jong -ASCEE
//
@ -6,7 +6,7 @@
// Implementation of the dFifo queue
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-5)
#include "dfifo.h"
#include "lasp_dfifo.h"
typedef struct dFifo_s {
dmat queue;

View File

@ -1,4 +1,4 @@
// dfifo.h
// lasp_dfifo.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,10 +6,11 @@
// API of a contiguous fifo buffer of samples.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef DFIFO_H
#define DFIFO_H
#include "types.h"
#include "ascee_math.h"
#ifndef LASP_DFIFO_H
#define LASPDFIFO_H
#include "lasp_types.h"
#include "lasp_math.h"
typedef struct dFifo_s dFifo;
/**
@ -67,6 +68,6 @@ us dFifo_size(dFifo* fifo);
*/
void dFifo_free(dFifo* fifo);
#endif // DFIFO_H
#endif // LASP_DFIFO_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// fft.cpp
// lasp_fft.c
//
// Author: J.A. de Jong - ASCEE
//
@ -6,9 +6,9 @@
//
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-5)
#include "ascee_tracer.h"
#include "fft.h"
#include "types.h"
#include "lasp_tracer.h"
#include "lasp_fft.h"
#include "lasp_types.h"
#include "fftpack.h"
typedef struct Fft_s {

View File

@ -1,4 +1,4 @@
// fft.h
// lasp_fft.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,10 +6,10 @@
// Interface to the FFT library, multiple channel FFT's
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef FFT_H
#define FFT_H
#include "types.h"
#include "ascee_math.h"
#ifndef LASP_FFT_H
#define LASP_FFT_H
#include "lasp_types.h"
#include "lasp_math.h"
/**
* Perform forward FFT's on real time data.
@ -82,5 +82,5 @@ void Fft_ifft(const Fft* fft,const cmat* freqdata,dmat* timedata);
*/
void Fft_free(Fft* fft);
#endif // FFT_H
#endif // LASP_FFT_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,15 +1,15 @@
// filterbank.c
// lasp_filterbank.c
//
// Author: J.A. de Jong -ASCEE
//
// Description:
// FilterBank implementation.
//////////////////////////////////////////////////////////////////////
#include "filterbank.h"
#include "fft.h"
#include "dfifo.h"
#include "ascee_tracer.h"
#include "ascee_alg.h"
#include "lasp_filterbank.h"
#include "lasp_fft.h"
#include "lasp_dfifo.h"
#include "lasp_tracer.h"
#include "lasp_alg.h"
#define FIFO_SIZE_MULT 2
typedef struct FilterBank_s {

View File

@ -1,4 +1,4 @@
// filterbank.h
// lasp_filterbank.h
//
// Author: J.A. de Jong - ASCEE
//
@ -12,8 +12,8 @@
#pragma once
#ifndef FILTERBANK_H
#define FILTERBANK_H
#include "types.h"
#include "ascee_math.h"
#include "lasp_types.h"
#include "lasp_math.h"
typedef struct FilterBank_s FilterBank;
/**

View File

@ -1,4 +1,4 @@
// ascee_math.c
// lasp_math.c
//
// Author: J.A. de Jong -ASCEE
//
@ -6,15 +6,15 @@
//
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-10)
#include "ascee_math.h"
#include "lasp_math.h"
#include "ascee_assert.h"
#include "ascee_math.h"
#include "ascee_tracer.h"
#include "lasp_assert.h"
#include "lasp_math.h"
#include "lasp_tracer.h"
#include <math.h>
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
void print_dmat(const dmat* m) {
fsTRACE(50);
size_t row,col;

View File

@ -1,4 +1,4 @@
// ascee_math.h
// lasp_math.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,12 +6,12 @@
// copying of matrices and vectors.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ASCEE_MATH_H
#define ASCEE_MATH_H
#include "ascee_math_raw.h"
#include "ascee_alloc.h"
#include "ascee_tracer.h"
#include "ascee_assert.h"
#ifndef LASP_MATH_H
#define LASP_MATH_H
#include "lasp_math_raw.h"
#include "lasp_alloc.h"
#include "lasp_tracer.h"
#include "lasp_assert.h"
/// Vector of floating point numbers
typedef struct {
@ -106,7 +106,7 @@ static inline c* getcmatval(const cmat* mat,const us row,const us col){
return &mat->_data[col*mat->stride+row];
}
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
#define OVERFLOW_MAGIC_NUMBER (-10e-45)
#define check_overflow_vx(vx) \
@ -195,16 +195,16 @@ static inline void cmat_set(cmat* mat,const c value){
*/
static inline vd vd_alloc(us size) {
vd result = { size, NULL,NULL};
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
result._data = (d*) a_malloc((size+1)*sizeof(d));
result._data[size] = OVERFLOW_MAGIC_NUMBER;
#else
result._data = (d*) a_malloc(size*sizeof(d));
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
result._foreign_data = false;
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
vd_set(&result,NAN);
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
return result;
}
/**
@ -216,16 +216,16 @@ static inline vd vd_alloc(us size) {
*/
static inline vc vc_alloc(us size) {
vc result = { size, NULL, NULL};
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
result._data = (c*) a_malloc((size+1)*sizeof(c));
result._data[size] = OVERFLOW_MAGIC_NUMBER;
#else
result._data = (c*) a_malloc(size*sizeof(c));
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
result._foreign_data = false;
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
vc_set(&result,NAN+I*NAN);
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
return result;
}
/**
@ -241,16 +241,16 @@ static inline dmat dmat_alloc(us n_rows,
us n_cols) {
dmat result = { n_rows, n_cols, false, n_rows, NULL};
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
result._data = (d*) a_malloc((n_rows*n_cols+1)*sizeof(d));
result._data[n_rows*n_cols] = OVERFLOW_MAGIC_NUMBER;
#else
result._data = (d*) a_malloc((n_rows*n_cols)*sizeof(d));
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
dmat_set(&result,NAN);
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
return result;
}
@ -269,16 +269,16 @@ static inline cmat cmat_alloc(const us n_rows,
const us n_cols) {
cmat result = { n_rows, n_cols, false, n_rows, NULL};
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
result._data = (c*) a_malloc((n_rows*n_cols+1)*sizeof(c));
result._data[n_rows*n_cols] = OVERFLOW_MAGIC_NUMBER;
#else
result._data = (c*) a_malloc((n_rows*n_cols)*sizeof(c));
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
cmat_set(&result,NAN+I*NAN);
#endif // ASCEE_DEBUG
#endif // LASP_DEBUG
return result;
}
/**
@ -583,7 +583,7 @@ static inline void cmat_conj(cmat* x) {
}
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
void print_cmat(const cmat* m);
void print_vc(const vc* m);
void print_vd(const vd* m);
@ -594,5 +594,5 @@ void print_dmat(const dmat* m);
#define print_dmat(m)
#endif
#endif // ASCEE_MATH_H
#endif // LASP_MATH_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// si_math.c
// lasp_math_raw.c
//
// last-edit-by: J.A. de Jong
//
@ -6,7 +6,7 @@
// Operations working on raw arrays of floating point numbers
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-5)
#include "ascee_math_raw.h"
#include "lasp_math_raw.h"
#if ASCEE_USE_BLAS
#include <cblas.h>
#endif

View File

@ -1,4 +1,4 @@
// ascee_math_raw.h
// lasp_math_raw.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,21 +6,21 @@
// complex numbers.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef ASCEE_MATH_RAW_H
#define ASCEE_MATH_RAW_H
#include "ascee_assert.h"
#include "ascee_tracer.h"
#include "types.h"
#ifndef LASP_MATH_RAW_H
#define LASP_MATH_RAW_H
#include "lasp_assert.h"
#include "lasp_tracer.h"
#include "lasp_types.h"
#include <math.h>
#if ASCEE_USE_BLAS == 1
#if LASP_USE_BLAS == 1
#include <cblas.h>
#elif ASCEE_USE_BLAS == 0
#elif LASP_USE_BLAS == 0
#else
#error "ASCEE_USE_BLAS should be set to either 0 or 1"
#error "LASP_USE_BLAS should be set to either 0 or 1"
#endif
#ifdef ASCEE_DOUBLE_PRECISION
#ifdef LASP_DOUBLE_PRECISION
#define c_real creal
#define c_imag cimag
#define d_abs fabs
@ -34,7 +34,7 @@
#define d_cos cos
#define d_pow pow
#else // ASCEE_DOUBLE_PRECISION not defined
#else // LASP_DOUBLE_PRECISION not defined
#define c_conj conjf
#define c_real crealf
#define c_imag cimagf
@ -48,7 +48,7 @@
#define d_cos cosf
#define d_pow powf
#endif // ASCEE_DOUBLE_PRECISION
#endif // LASP_DOUBLE_PRECISION
#ifdef M_PI
static const d number_pi = M_PI;
@ -114,7 +114,7 @@ static inline c cd_dot(const c a[],const d b[],us size){
}
/**
* Return the dot product of two complex-valued arrays. Wraps BLAS
* when ASCEE_USE_BLAS == 1.
* when LASP_USE_BLAS == 1.
*
* @param a complex-valued array
* @param b complex-valued array
@ -123,9 +123,9 @@ static inline c cd_dot(const c a[],const d b[],us size){
* @return the dot product
*/
static inline c cc_dot(const c a[],const c b[],us size){
#if ASCEE_USE_BLAS == 1
#if LASP_USE_BLAS == 1
WARN("CBlas zdotu not yet tested");
#if ASCEE_DOUBLE_PRECISION
#if LASP_DOUBLE_PRECISION
// assert(0);
return cblas_zdotu(size,(d*) a,1,(d*) b,1);
#else
@ -150,8 +150,8 @@ static inline c cc_dot(const c a[],const c b[],us size){
* @return The result.
*/
static inline d d_dot(const d a[],const d b[],const us size){
#if ASCEE_USE_BLAS == 1
#if ASCEE_DOUBLE_PRECISION
#if LASP_USE_BLAS == 1
#if LASP_DOUBLE_PRECISION
return cblas_ddot(size,a,1,b,1);
#else // Single precision function
return cblas_sdot(size,a,1,b,1);
@ -175,7 +175,7 @@ static inline d d_dot(const d a[],const d b[],const us size){
* @param size : Size of arrays
*/
static inline void d_copy(d to[],const d from[],const us size){
#if ASCEE_USE_BLAS == 1
#if LASP_USE_BLAS == 1
cblas_dcopy(size,from,1,to,1);
#else
us i;
@ -210,8 +210,8 @@ static inline void cd_copy(c to[],const d from[],const us size) {
*/
static inline void c_copy(c to[],const c from[],const us size){
#if ASCEE_USE_BLAS == 1
#if ASCEE_DOUBLE_PRECISION
#if LASP_USE_BLAS == 1
#if LASP_DOUBLE_PRECISION
cblas_zcopy(size,(d*) from,1,(d*) to,1);
#else
cblas_ccopy(size,(d*) from,1,(d*) to,1);
@ -232,8 +232,8 @@ static inline void c_copy(c to[],const c from[],const us size){
*/
static inline void d_add_to(d x[],const d y[],
const d fac,const us size){
#if ASCEE_USE_BLAS == 1
#if ASCEE_DOUBLE_PRECISION
#if LASP_USE_BLAS == 1
#if LASP_DOUBLE_PRECISION
cblas_daxpy(size,fac,y,1,x,1);
#else
cblas_saxpy(size,fac,y,1,x,1);
@ -255,8 +255,8 @@ static inline void d_add_to(d x[],const d y[],
static inline void c_add_to(c x[],const c y[],
const c fac,const us size){
fsTRACE(15);
#if ASCEE_USE_BLAS == 1
#if ASCEE_DOUBLE_PRECISION
#if LASP_USE_BLAS == 1
#if LASP_DOUBLE_PRECISION
cblas_zaxpy(size,(d*) &fac,(d*) y,1,(d*) x,1);
#else
cblas_caxpy(size,(d*) &fac,(d*) y,1,(d*) x,1);
@ -277,8 +277,8 @@ static inline void c_add_to(c x[],const c y[],
* @param size size of the array
*/
static inline void d_scale(d a[],const d scale_fac,us size){
#if ASCEE_USE_BLAS == 1
#if ASCEE_DOUBLE_PRECISION
#if LASP_USE_BLAS == 1
#if LASP_DOUBLE_PRECISION
cblas_dscal(size,scale_fac,a,1);
#else
cblas_sscal(size,scale_fac,a,1);
@ -299,14 +299,14 @@ static inline void d_scale(d a[],const d scale_fac,us size){
* @param size size of the array
*/
static inline void c_scale(c a[],const c scale_fac,us size){
#if ASCEE_USE_BLAS == 1
#if LASP_USE_BLAS == 1
// Complex argument should be given in as array of two double
// values. The first the real part, the second the imaginary
// part. Fortunately the (c) type stores the two values in this
// order. To be portable and absolutely sure anything goes well,
// we convert it explicitly here.
#if ASCEE_DOUBLE_PRECISION
#if LASP_DOUBLE_PRECISION
cblas_zscal(size,(d*) &scale_fac,(d*) a,1);
#else
cblas_cscal(size,(d*) &scale_fac,(d*) a,1);
@ -357,7 +357,7 @@ static inline d d_min(const d a[],us size){
* @param size Size of array
*/
static inline d d_norm(const d a[],us size){
#if ASCEE_USE_BLAS == 1
#if LASP_USE_BLAS == 1
return cblas_dnrm2(size,a,1);
#else
d norm = 0;
@ -378,7 +378,7 @@ static inline d d_norm(const d a[],us size){
* @param size Size of array
*/
static inline d c_norm(const c a[],us size){
#if ASCEE_USE_BLAS == 1
#if LASP_USE_BLAS == 1
return cblas_dznrm2(size,(d*) a,1);
#else
d norm = 0;
@ -434,8 +434,8 @@ static inline void carray_conj(c res[],const c in[],const us size) {
// First set the result vector to zero
fsTRACE(15);
c_set(res,0,size);
#if ASCEE_USE_BLAS == 1
#if ASCEE_DOUBLE_PRECISION
#if LASP_USE_BLAS == 1
#if LASP_DOUBLE_PRECISION
// Cast as a float, scale all odd elements with minus one to find
// the complex conjugate.
cblas_daxpy(size ,1.0,(d*) in,2,(d*) res,2);
@ -443,12 +443,12 @@ static inline void carray_conj(c res[],const c in[],const us size) {
#else
cblas_faxpy(size ,1,(d*) in,2,(d*) res,2);
cblas_faxpy(size,-1,&((d*) in)[1],2,&((d*) res)[1],2);
#endif // ASCEE_DOUBLE_PRECISION
#endif // LASP_DOUBLE_PRECISION
#else
for(us i=0;i<size;i++) {
res[i] = c_conj(in[i]);
}
#endif // ASCEE_USE_BLAS
#endif // LASP_USE_BLAS
feTRACE(15);
}
/**
@ -458,20 +458,20 @@ static inline void carray_conj(c res[],const c in[],const us size) {
* @param size Size of the vector
*/
static inline void c_conj_inplace(c res[],us size) {
#if ASCEE_USE_BLAS
#if ASCEE_DOUBLE_PRECISION
#if LASP_USE_BLAS
#if LASP_DOUBLE_PRECISION
// Cast as a float, scale all odd elements with minus one to find
// the complex conjugate.
cblas_dscal(size,-1,&((d*) res)[1],2);
#else
cblas_sscal(size,-1,&((d*) res)[1],2);
#endif // ASCEE_DOUBLE_PRECISION
#endif // LASP_DOUBLE_PRECISION
#else
for(us i=0;i<size;i++) {
res[i] = c_conj(res[i]);
}
#endif // ASCEE_USE_BLAS
#endif // LASP_USE_BLAS
}
#endif // ASCEE_MATH_RAW_H
#endif // LASP_MATH_RAW_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// mq.c
// lasp_mq.c
//
// Author: J.A. de Jong -ASCEE
//
@ -7,11 +7,11 @@
// different threads.
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-6)
#include "types.h"
#include "ascee_tracer.h"
#include "ascee_assert.h"
#include "ascee_alloc.h"
#include "mq.h"
#include "lasp_types.h"
#include "lasp_tracer.h"
#include "lasp_assert.h"
#include "lasp_alloc.h"
#include "lasp_mq.h"
#include <pthread.h>
/* #ifdef linux */
@ -89,8 +89,8 @@ void print_job_queue(JobQueue* jq) {
JobQueue* JobQueue_alloc(const us max_jobs) {
TRACE(15,"JobQueue_alloc");
if(max_jobs > ASCEE_MAX_NUM_CHANNELS) {
WARN("Max jobs restricted to ASCEE_MAX_NUM_CHANNELS");
if(max_jobs > LASP_MAX_NUM_CHANNELS) {
WARN("Max jobs restricted to LASP_MAX_NUM_CHANNELS");
return NULL;
}
JobQueue* jq = a_malloc(sizeof(JobQueue));
@ -252,7 +252,7 @@ void* JobQueue_assign(JobQueue* jq) {
}
TRACE(16,"JobQueue_assign: found ready job. Assigned to:");
#ifdef ASCEE_DEBUG
#ifdef LASP_DEBUG
pthread_t thisthread = pthread_self();
iVARTRACE(16,thisthread);
#endif

View File

@ -1,4 +1,4 @@
// ps.c
// lasp_ps.c
//
// Author: J.A. de Jong -ASCEE
//
@ -6,11 +6,11 @@
//
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-5)
#include "ps.h"
#include "fft.h"
#include "ascee_alloc.h"
#include "ascee_alg.h"
#include "ascee_assert.h"
#include "lasp_ps.h"
#include "lasp_fft.h"
#include "lasp_alloc.h"
#include "lasp_alg.h"
#include "lasp_assert.h"
typedef struct PowerSpectra_s {

View File

@ -1,4 +1,4 @@
// ps.h
// lasp_ps.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,9 +6,9 @@
// routines.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef PS_H
#define PS_H
#include "window.h"
#ifndef LASP_PS_H
#define LASP_PS_H
#include "lasp_window.h"
typedef struct PowerSpectra_s PowerSpectra;
@ -57,5 +57,5 @@ void PowerSpectra_free(PowerSpectra* ps);
#endif // PS_H
#endif // LASP_PS_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// signals.h
// lasp_signals.h
//
// Author: J.A. de Jong - ASCEE
//
@ -6,9 +6,9 @@
// Several signal functions
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef SIGNALS_H
#define SIGNALS_H
#include "ascee_math.h"
#ifndef LASP_SIGNALS_H
#define LASP_SIGNALS_H
#include "lasp_math.h"
/**
* Compute the signal power, that is \f$ \frac{1}{N} \sum_{i=0}^{N-1}
@ -28,5 +28,5 @@ static inline d signal_power(vd* signal) {
#endif // SIGNALS_H
#endif // LASP_SIGNALS_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// si_tracer.c
// lasp_tracer.c
//
// last-edit-by: J.A. de Jong
//
@ -7,8 +7,8 @@
//////////////////////////////////////////////////////////////////////
#if TRACER == 1
#include <stdio.h>
#include "ascee_tracer.h"
#include "types.h"
#include "lasp_tracer.h"
#include "lasp_types.h"
#ifdef _REENTRANT
#include <stdatomic.h>

View File

@ -129,7 +129,7 @@ extern int TRACERNAME;
static inline int getTracerLevel() { return TRACERNAME;}
#endif
#include "types.h"
#include "lasp_types.h"
// Use this preprocessor command to introduce one TRACERNAME integer per unit
/* Introduce one static logger */

View File

@ -7,18 +7,18 @@
// needed.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef TYPES_H
#define TYPES_H
#ifndef LASP_TYPES_H
#define LASP_TYPES_H
#include <stddef.h>
// // Branch prediction performance improvement
#if !defined(likely)
#if defined(__GNUC__) && !defined(ASCEE_DEBUG)
#if defined(__GNUC__) && !defined(LASP_DEBUG)
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else
#define likely(x) (x)
#define unlikely(x) (x)
#endif // if defined(__GNUC__) && !defined(ASCEE_DEBUG)
#endif // if defined(__GNUC__) && !defined(LASP_DEBUG)
#endif // !defined(likely)
@ -30,14 +30,14 @@ typedef size_t us; /* Size type I always use */
// To change the whole code to 32-bit floating points, change this to
// float.
#if ASCEE_FLOAT == 32
#if LASP_FLOAT == 32
typedef float d; /* Shortcut for double */
typedef float complex c;
#elif ASCEE_FLOAT == 64
#elif LASP_FLOAT == 64
typedef double d; /* Shortcut for double */
typedef double complex c;
#else
#error ASCEE_FLOAT should be either 32 or 64
#error LASP_FLOAT should be either 32 or 64
#endif
@ -49,7 +49,6 @@ typedef double complex c;
#define FAILURE -2
#endif // ASCEE_TYPES_H
#endif // LASP_TYPES_H
//////////////////////////////////////////////////////////////////////

View File

@ -6,8 +6,8 @@
//
//////////////////////////////////////////////////////////////////////
#include "window.h"
#include "signals.h"
#include "lasp_window.h"
#include "lasp_signals.h"
#include <stdlib.h>
/**
* Compute the Hann window

View File

@ -6,9 +6,9 @@
//
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef WINDOW_H
#define WINDOW_H
#include "ascee_math.h"
#ifndef LASP_WINDOW_H
#define LASP_WINDOW_H
#include "lasp_math.h"
typedef enum {
Hann = 0,
@ -33,5 +33,5 @@ typedef enum {
int window_create(const WindowType wintype,vd* result,d* win_power);
#endif // WINDOW_H
#endif // LASP_WINDOW_H
//////////////////////////////////////////////////////////////////////

View File

@ -1,4 +1,4 @@
// worker.c
// lasp_worker.c
//
// Author: J.A. de Jong -ASCEE
//
@ -6,12 +6,12 @@
//
//////////////////////////////////////////////////////////////////////
#define TRACERPLUS (-5)
#include "worker.h"
#include "mq.h"
#include "ascee_alloc.h"
#include "lasp_worker.h"
#include "lasp_mq.h"
#include "lasp_alloc.h"
#include <pthread.h>
#include "ascee_assert.h"
#include "ascee_tracer.h"
#include "lasp_assert.h"
#include "lasp_tracer.h"
typedef struct Workers_s {
JobQueue* jq;
@ -22,7 +22,7 @@ typedef struct Workers_s {
pthread_mutex_t global_data_mutex;
void* global_data;
pthread_t worker_threads[ASCEE_MAX_NUM_THREADS];
pthread_t worker_threads[LASP_MAX_NUM_THREADS];
us num_workers;
} Workers;
@ -37,7 +37,7 @@ Workers* Workers_create(const us num_workers,
TRACE(15,"Workers_create");
if(num_workers > ASCEE_MAX_NUM_THREADS) {
if(num_workers > LASP_MAX_NUM_THREADS) {
WARN("Number of workers too high in Workers_create");
return NULL;
}

View File

@ -8,9 +8,9 @@
// on the push of a new job.
//////////////////////////////////////////////////////////////////////
#pragma once
#ifndef WORKER_H
#define WORKER_H
#include "types.h"
#ifndef LASP_WORKER_H
#define LASP_WORKER_H
#include "lasp_types.h"
typedef struct Workers_s Workers;
typedef struct JobQueue_s JobQueue;
@ -57,5 +57,5 @@ Workers* Workers_create(const us num_workers,
*/
void Workers_free(Workers* w);
#endif // WORKER_H
#endif // LASP_WORKER_H
//////////////////////////////////////////////////////////////////////

View File

@ -3,9 +3,9 @@ import numpy as np
cimport numpy as np
from libcpp cimport bool
DEF ASCEE_FLOAT = "@ASCEE_FLOAT@"
DEF LASP_FLOAT = "@LASP_FLOAT@"
IF ASCEE_FLOAT == "double":
IF LASP_FLOAT == "double":
ctypedef double d
ctypedef double complex c
NUMPY_FLOAT_TYPE = np.float64
@ -23,13 +23,13 @@ ELSE:
ctypedef size_t us
cdef extern from "ascee_tracer.h":
cdef extern from "lasp_tracer.h":
void setTracerLevel(int)
void TRACE(int,const char*)
void fsTRACE(int)
void feTRACE(int)
void clearScreen()
cdef extern from "ascee_math.h":
cdef extern from "lasp_math.h":
ctypedef struct dmat:
us n_cols
us n_rows
@ -60,6 +60,6 @@ cdef extern from "ascee_math.h":
cdef extern from "numpy/arrayobject.h":
void PyArray_ENABLEFLAGS(np.ndarray arr, int flags)
cdef extern from "ascee_python.h":
cdef extern from "lasp_python.h":
object dmat_to_ndarray(dmat*,bint transfer_ownership)

View File

@ -15,7 +15,7 @@ def cls():
clearScreen()
# cls()
cdef extern from "fft.h":
cdef extern from "lasp_fft.h":
ctypedef struct c_Fft "Fft"
c_Fft* Fft_create(us nfft)
void Fft_free(c_Fft*)
@ -96,7 +96,7 @@ cdef class Fft:
cdef extern from "window.h":
cdef extern from "lasp_window.h":
ctypedef enum WindowType:
Hann
Hamming
@ -111,7 +111,7 @@ rectangular = Rectangular
bartlett = Bartlett
blackman = Blackman
cdef extern from "ps.h":
cdef extern from "lasp_ps.h":
ctypedef struct c_PowerSpectra "PowerSpectra"
c_PowerSpectra* PowerSpectra_alloc(const us nfft,
const WindowType wt)
@ -177,7 +177,7 @@ cdef class PowerSpectra:
PowerSpectra_free(self._ps)
cdef extern from "aps.h":
cdef extern from "lasp_aps.h":
ctypedef struct c_AvPowerSpectra "AvPowerSpectra"
c_AvPowerSpectra* AvPowerSpectra_alloc(const us nfft,
const us nchannels,
@ -260,7 +260,7 @@ cdef class AvPowerSpectra:
return result
cdef extern from "filterbank.h":
cdef extern from "lasp_filterbank.h":
ctypedef struct c_FilterBank "FilterBank":
pass
c_FilterBank* FilterBank_create(const dmat* h,const us nfft) nogil

View File

@ -9,9 +9,9 @@ descr = "Python wrappers around several C++ optimized beamforming codes"
setup(
name="Beamforming",
name="LASP",
version="1.0",
packages=['beamforming'],
packages=['lasp'],
author='J.A. de Jong - ASCEE',
author_email="j.a.dejong@ascee.nl",
# Project uses reStructuredText, so ensure that the docutils get
@ -20,7 +20,7 @@ setup(
license='MIT',
description=descr,
keywords="Beamforming",
url="http://www.ascee.nl/beamforming/", # project home page, if any
keywords="",
url="http://www.ascee.nl/lasp/", # project home page, if any
)

View File

@ -1,9 +1,9 @@
include_directories(${CMAKE_SOURCE_DIR}/beamforming/c)
include_directories(${CMAKE_SOURCE_DIR}/lasp/c)
add_executable(test_bf test_bf.c)
add_executable(test_workers test_workers.c)
add_executable(test_fft test_fft.c)
add_executable(test_math test_math.c)
target_link_libraries(test_bf beamforming_lib)
target_link_libraries(test_fft beamforming_lib pthread)
target_link_libraries(test_workers beamforming_lib pthread)
target_link_libraries(test_math beamforming_lib pthread efence)
target_link_libraries(test_bf lasp_lib)
target_link_libraries(test_fft lasp_lib pthread)
target_link_libraries(test_workers lasp_lib pthread)
target_link_libraries(test_math lasp_lib pthread)

View File

@ -5,7 +5,7 @@
// Description:
//
//////////////////////////////////////////////////////////////////////
#include "ascee_math.h"
#include "lasp_math.h"
int main() {

View File

@ -6,8 +6,8 @@
//
//////////////////////////////////////////////////////////////////////
#include "fft.h"
#include "ascee_tracer.h"
#include "lasp_fft.h"
#include "lasp_tracer.h"
int main() {

View File

@ -6,10 +6,10 @@
//
//////////////////////////////////////////////////////////////////////
#include "fft.h"
#include "ascee_math.h"
#include "ascee_tracer.h"
#include "ascee_alg.h"
#include "lasp_fft.h"
#include "lasp_math.h"
#include "lasp_tracer.h"
#include "lasp_alg.h"
int main() {

View File

@ -5,10 +5,10 @@
// Description:
//
//////////////////////////////////////////////////////////////////////
#include "worker.h"
#include "mq.h"
#include "ascee_tracer.h"
#include "ascee_assert.h"
#include "lasp_worker.h"
#include "lasp_mq.h"
#include "lasp_tracer.h"
#include "lasp_assert.h"
#include <unistd.h>
static void* walloc(void*);
static int worker(void*,void*);