Commit 33447e0b authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed mixed-type exp and log functions, used in HMMs (thanks to V. Mityaev)

parent d199100d
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#ifndef __OPENCV_IMGPROC_COMPAT_C_H__ #ifndef __OPENCV_IMGPROC_COMPAT_C_H__
#define __OPENCV_IMGPROC_COMPAT_C_H__ #define __OPENCV_IMGPROC_COMPAT_C_H__
#include <math.h>
#include <string.h> #include <string.h>
#ifdef __cplusplus #ifdef __cplusplus
...@@ -318,17 +319,17 @@ CV_INLINE void cvbReciprocal( const float* x, float* y, int len ) ...@@ -318,17 +319,17 @@ CV_INLINE void cvbReciprocal( const float* x, float* y, int len )
CV_INLINE void cvbFastExp( const float* x, double* y, int len ) CV_INLINE void cvbFastExp( const float* x, double* y, int len )
{ {
CvMat mx = cvMat( 1, len, CV_32F, (void*)x ); int i;
CvMat my = cvMat( 1, len, CV_64F, y ); for( i = 0; i < len; i++ )
cvExp( &mx, &my ); y[i] = exp((double)x[i]);
} }
CV_INLINE void cvbFastLog( const double* x, float* y, int len ) CV_INLINE void cvbFastLog( const double* x, float* y, int len )
{ {
CvMat mx = cvMat( 1, len, CV_64F, (void*)x ); int i;
CvMat my = cvMat( 1, len, CV_32F, y ); for( i = 0; i < len; i++ )
cvLog( &mx, &my ); y[i] = (float)log(x[i]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment