-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComplexNANClass.h
56 lines (51 loc) · 1.1 KB
/
ComplexNANClass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#ifndef COMPLEXNANCLASS_H
#define COMPLEXNANCLASS_H
#include "ComplexCoreClass.h"
TemplateDefinition
class ComplexNANClass : ComplexCoreClass <TemplateParameter>
{
public:
ComplexNANClass()
{
// dont call base class default constructor directly, icc has problem with it.
// default constructor of base class automatically called befor constructor of derived class.
// but parametrized constructor of base class should be called explicitly.
}
ComplexNANClass(MemoryManagerClass *MemoryManager) : BaseConstructor
{
}
void SetNaNToZero(Ts* A, int Len)
{
for (int i = 0; i < Len; i++)
{
bool isNAN = isnan(A[i]);
if (isNAN)
{
A[i] = 0;
}
}
}
void SetNaNToZero(Tc* A, int Len)
{
for (int i = 0; i < Len; i++)
{
bool isNAN1 = isnan(A[i].real);
bool isNAN2 = isnan(A[i].imag);
if (isNAN1 || isNAN2)
{
A[i].real = 0;
A[i].imag = 0;
}
}
}
void SetNaNToZero(Tca A)
{
SetNaNToZero(A.GetArray(), A.Length);
}
void SetNaNToZero(Ta A)
{
SetNaNToZero(A.GetArray(), A.Length);
}
};
#endif