im_math_op.h File Reference
Detailed Description
See Copyright Notice in im_lib.h- Id
- Exp
Go to the source code of this file.
Functions | |
| template<class T> | |
| T | crop_byte (const T &v) |
| template<class T1, class T2> | |
| T1 | add_op (const T1 &v1, const T2 &v2) |
| template<class T1, class T2> | |
| T1 | sub_op (const T1 &v1, const T2 &v2) |
| template<class T1, class T2> | |
| T1 | mul_op (const T1 &v1, const T2 &v2) |
| template<class T1, class T2> | |
| T1 | div_op (const T1 &v1, const T2 &v2) |
| template<class T> | |
| T | inv_op (const T &v) |
| template<class T1, class T2> | |
| T1 | diff_op (const T1 &v1, const T2 &v2) |
| template<class T1, class T2> | |
| T1 | min_op (const T1 &v1, const T2 &v2) |
| template<class T1, class T2> | |
| T1 | max_op (const T1 &v1, const T2 &v2) |
| template<class T1, class T2> | |
| T1 | pow_op (const T1 &v1, const T2 &v2) |
| template<class T> | |
| T | abs_op (const T &v) |
| template<class T> | |
| T | less_op (const T &v) |
| template<class T> | |
| T | sqr_op (const T &v) |
| int | sqrt (const int &C) |
| template<class T> | |
| T | sqrt_op (const T &v) |
| int | exp (const int &v) |
| template<class T> | |
| T | exp_op (const T &v) |
| int | log (const int &v) |
| template<class T> | |
| T | log_op (const T &v) |
| imcfloat | sin (const imcfloat &v) |
| int | sin (const int &v) |
| template<class T> | |
| T | sin_op (const T &v) |
| int | cos (const int &v) |
| imcfloat | cos (const imcfloat &v) |
| template<class T> | |
| T | cos_op (const T &v) |
| void | imDataBitSet (imbyte *data, int index, int bit) |
| int | imDataBitGet (imbyte *data, int index) |
Function Documentation
|
||||||||||
|
Crop value to Byte limit.
00019 {
00020 return v <= 0? 0: v <= 255? v: 255;
00021 }
|
|
||||||||||||||||
|
Generic Addition with 2 template types.
00026 {
00027 return v2 + v1;
00028 }
|
|
||||||||||||||||
|
Generic Subtraction with 2 template types.
00033 {
00034 return v2 - v1;
00035 }
|
|
||||||||||||||||
|
Generic Multiplication with 2 template types.
00040 {
00041 return v2 * v1;
00042 }
|
|
||||||||||||||||
|
Generic Division with 2 template types.
00047 {
00048 // if (v2 == 0) return (T1)IM_NEARINF;
00049 return v1 / v2;
00050 }
|
|
||||||||||
|
Generic Invert.
00055 {
00056 // if (v == 0) return (T)IM_NEARINF;
00057 return 1/v;
00058 }
|
|
||||||||||||||||
|
Generic Difference with 2 template types.
00063 {
00064 if (v1 <= v2)
00065 return v2 - v1;
00066 return v1 - v2;
00067 }
|
|
||||||||||||||||
|
Generic Minimum with 2 template types.
00072 {
00073 if (v1 <= v2)
00074 return v1;
00075 return v2;
00076 }
|
|
||||||||||||||||
|
Generic Maximum with 2 template types.
00081 {
00082 if (v1 <= v2)
00083 return v2;
00084 return v1;
00085 }
|
|
||||||||||||||||
|
Generic Power with 2 template types.
00090 {
00091 return (T1)pow(v1, v2);
00092 }
|
|
||||||||||
|
Generic Abssolute.
00097 {
00098 if (v <= 0)
00099 return -1*v;
00100 return v;
00101 }
|
|
||||||||||
|
Generic Less.
00106 {
00107 return -1*v;
00108 }
|
|
||||||||||
|
Generic Square.
00113 {
00114 return v*v;
00115 }
|
|
||||||||||
|
Generic Square Root.
00125 {
00126 return (T)sqrt(v);
00127 }
|
|
||||||||||
|
Generic Exponential.
00137 {
00138 return (T)exp(v);
00139 }
|
|
||||||||||
|
Generic Logarithm.
00149 {
00150 // if (v <= 0) return (T)IM_NEARINF;
00151 return (T)log(v);
00152 }
|
|
||||||||||
|
Generic Sine.
00168 {
00169 return (T)sin(v);
00170 }
|
|
||||||||||
|
Generic Cosine.
00186 {
00187 return (T)cos(v);
00188 }
|
|
||||||||||||||||
|
Sets a bit in an array.
00192 {
00193 if (bit)
00194 data[index / 8] |= (0x01 << (7 - (index % 8)));
00195 else
00196 data[index / 8] &= ~(0x01 << (7 - (index % 8)));
00197 }
|
|
||||||||||||
|
Gets a bit from an array.
00201 {
00202 return (data[index / 8] >> (7 - (index % 8))) & 0x01;
00203 }
|