I'm trying to optimize my code to the maximum performance, I have 3x3 matrix, I'm calculating the inverse using the function
matinv from the CESS library.I'm wondering if the performance of this function is better than calculating the inverse manually using the determinant and the minor matrix in the special case of 3by3 matrix.thanks in advance.
Hi,The C and C++ run-time libraries are collections of functions, macros, and class templates that may be called fromyour source programs. The libraries provide a broad range of services, including those…
Moving to Software and Development Tools
Hi,The C and C++ run-time libraries are collections of functions, macros, and class templates that may be called fromyour source programs. The libraries provide a broad range of services, including those that are basic to the languages such as memory allocation, character and string conversions, and math calculations. Using the library simplifies soft-ware development by providing code for a variety of common needs.The matinv (Real matrix inversion)functions employ Gauss-Jordan elimination with full pivoting to compute the inverse of the input matrix input and store the result in the matrix output.You will find more information on all the methods of determining the performance of functions through cycle counts at the following section of our documentation in CCES help:CrossCore® Embedded Studio 2.x.x > SHARC/ Blackfin Development Tools Documentation > C/C++ Library Manual for SHARC® Processors > C/C++ Run-Time Library > C and C++ Run-Time Libraries Guide > Measuring Cycle CountsCalculating cycle counts is generally done on a particular piece of code which you would like to optimize so that you achieve the lowest cycle count possible.Also, The optimizer in the C/C++ compiler is designed to generate efficient code from source that has been written in a straightforward manner. The basic strategy for tuning a program is to present the algorithm in a way that gives the optimizer the best possible visibility of the operations and data, and hence the greatest freedom to safely manipulate the code.As optimization happens, the code is transformed, duplicated, rearranged and rewritten in a multitude of different ways. This process breaks the simple one-to-one mapping between source code and the compiler's internal representation. As the aim is to produce the highest performing code possible, the optimization transformations are not constrained at all by the potential to map statements back to their source lines.The optimizer is enabled in the IDE by selecting Project > Properties > C/C++ Build > Settings > Tool Settings > Compiler > General > Enable optimization, or by using the -O switch. A "release" build from within CCES automatically enables optimization.Regards,Nishanthi.V
thanks, this was a useful indication, I was already testing the optimizer, there were also very noticeable different when using 32 bit float point and 64 bit long double representation, when using the 64 bit long double the execution time of the whole function was about 1600 micro seconds, while using 32 bit float representation with the same exact calculation the execution time dropped to 120 micro seconds (100 times faster).
I'm going to see the Gauss-Jordan elimination algorithm then I can easily see which method is faster.
thanks a lot.