vector_copy

Digital Signal Processing Library

Voice Lab

Program name: vector_copy

Language: C

In file: vector_lib.c

Objective: Copy a vector to another

Usage: void vector_copy(double *vector1, int vector_width, double **vector2);

Parameters:

  • vector1 - The pointer to the input vector array
  • vector_width - Number of elements in each vector
  • vector2 - The pointer to the output vector array address
Return value:
  • void

Mathematical Description:

Comments: Routine is used to copy a vector to another

User Comments

Code:

void vector_copy(double *vector1, int vector_width, double **vector2)
{
int i;

if(vector_width > MAX_VECTOR_WIDTH) {
fprintf(stderr, "vector_width greater than MAX_VECTOR_WIDTH\n");
fprintf(stderr, "Please increase MAX_VECTOR_WIDTH in vector_lib.h and recompile.\n");
exit(-1);
}

for(i = 0; i < vector_width; i++){
(*vector2)[i] = vector1[i];
}
return;
}