VCSBeam
Functions
filter.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "vcsbeam.h"
#include "gpu_macros.h"
Include dependency graph for filter.c:

Functions

gpuDoubleComplex * roots_of_unity (int N)
 Calculates complex roots of unity. More...
 
void vmLoadFilter (vcsbeam_context *vm, char *filtername, filter_type type, int nchans)
 Load a set of filter coefficients. More...
 
void vmScaleFilterCoeffs (vcsbeam_context *vm, filter_type type, double scale_factor)
 Scale the filter coefficients by constant factor. More...
 
void free_pfb_filter (pfb_filter *filter)
 Free the memory associated with a PFB filter. More...
 

Function Documentation

◆ free_pfb_filter()

void free_pfb_filter ( pfb_filter *  filter)

Free the memory associated with a PFB filter.

Parameters
filterThe filter to be freed/

This function frees both the member variables and the filter itself.

◆ roots_of_unity()

gpuDoubleComplex* roots_of_unity ( int  N)

Calculates complex roots of unity.

Parameters
NThe number of roots to calculate
Returns
A list of all complex numbers \(z\) such that \(z^N = 1\).

◆ vmLoadFilter()

void vmLoadFilter ( vcsbeam_context *  vm,
char *  filtername,
filter_type  type,
int  nchans 
)

Load a set of filter coefficients.

Parameters
vmThe VCSBeam context struct
filternameString specifying a filter. There should be a corresponding file in the RUNTIME_DIR called <filtername>.dat.
typeEither ANALYSIS_FILTER or SYNTHESIS_FILTER
nchansThe number of channels that this filter will be applied to. For both ANALYSIS and SYNTHESIS filters, this should be the number of ANALYSIS channels.
Todo:
Change nchans so that it uses vm→nfine_chans

◆ vmScaleFilterCoeffs()

void vmScaleFilterCoeffs ( vcsbeam_context *  vm,
filter_type  type,
double  scale_factor 
)

Scale the filter coefficients by constant factor.

Parameters
vmThe VCSBeam context struct
typeEither ANALYSIS_FILTER or SYNTHESIS_FILTER
scale_factorThe scaling factor