User`s guide
7 Libraries
memcpy(mxGetPr(in1), data, 9*sizeof(double));
memcpy(mxGetPr(in2), data, 9*sizeof(double));
/* Call the library intialization routine and make sure that
* the library was initialized properly. */
if (!libmatrixInitial ize( )){
fprintf(stderr,"Could not initialize the library.\n");
*err = -2;
}
else
{
/* Call the library function */
mlfAddmatrix(1, &out, in1, in2);
/* Display the return value of the library function */
printf("The value of added matrix is:\n");
display(out);
/* Destroy the return value since this varaible will be reused
* in the next function call. Since we are going t o reuse the
* variable, we have to set it to NULL. Ref er to MATLAB Compiler
* documentation for more information on this. */
mxDestroyArray(out); out=0;
mlfMultiplymatrix(1, &out, in1, in2);
printf("The value of the multiplied matrix is:\n");
display(out);
mxDestroyArray(out); out=0;
mlfEigmatrix(1, &out, in1);
printf("The eigenvalu es of the first matrix are:\n");
display(out);
mxDestroyArray(out); out=0;
/* Call the library termination routine */
libmatrixTerminate();
/* Free the memory created */
mxDestroyArray(in1); in1=0;
mxDestroyArray(in2); in2 = 0;
}
/* On MAC, you need to call mclSe tExi tCode with the appropriate
* exit status. Also, no te that you should call mclTermina te
* application in the end of your application.
7-34