Read the book's chapter on Nelder-Mead. In particular,
read about the
rank_vertices()
function and learn what it is
expected to do. Code the function accordingly, then
test it. Here is how.
The file rank-vertices-test.c
is a stand-alone C program which has a placeholder for the
rank_vertices()
function. Insert your code for the function
there. Don't change anything else. Compile the program, as in
cc -Wall -pedantic -std=c99 rank-vertices.cand execute. If your
rank_vertices()
works
correctly, the program will exit silently. Otherwise it
will print diagnostics about what went wrong.
Here is a sketch of the file demo-energy.c from Project 18.2 on page 207. The book's description of that file is perhaps too terse. Comments in this online sketch provide a little more of the details to help you along with completing the project.
static inline void replace_row(double **s, int i, double *r)That
i
should be iz
.
Programming Projects in C |