O'Reilly logo

Signal Processing in C by Thomas B. Passin, Christopher E. Reid

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 6

Programming Vectors and Matrices

Vectors and matrices are the two most common data structures used in digital signal processing. Efficiency and ease of use are therefore of central importance for these structures. Of course, C provides a structure for vectors and even matrices. Why not just use these structures as supplied? For simple, quick routines that are going to be used for just a short time, and probably only by the developer, using the supplied structures may be the best choice. However, if the goal is to build a large library of routines with an easily remembered interface and built-in error checking, something more is needed.

This chapter develops the vector and matrix structures used in the Companion Library. Section 6.1 explores some of the helpful features of the new ANSI standard for C, especially function prototypes and the resulting type checking. Section 6.2 uses the examples of Section 6.1 to introduce the vector structure used in the Companion Library and to explore some of its advantages. Section 6.3 compares the efficiencies of three different versions of the same function, one using the encapsulated vector structure introduced in Section 6.2 and the other two not. The surprising result is that there is no measurable loss of runtime efficiency. Section 6.4 compares the chosen structure of vectors with an alternative structure. The reasons for the choice made for the Companion Library are carefully explained. Section 6.5 introduces the matrix structure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required