Added complex numbers to bmath lib
This commit is contained in:
parent
60d069924d
commit
c46007ac32
5 changed files with 28 additions and 42 deletions
|
@ -13,6 +13,7 @@ add_executable(
|
|||
src/core/cpu/sse.cpp
|
||||
src/core/cpu/naive.cpp
|
||||
src/core/cpu/avx2.cpp
|
||||
src/core/bmath/complex.cpp
|
||||
sse.cpp
|
||||
)
|
||||
|
||||
|
|
15
main.cpp
15
main.cpp
|
@ -1,29 +1,14 @@
|
|||
#include <iostream>
|
||||
#include "src/core/blist.hpp"
|
||||
#include "src/core/bmath/bmath.h"
|
||||
#include "src/core/cpu/avx2.hpp"
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace Core::bmath;
|
||||
using namespace Core::Cpu;
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
BMath bm1 = BMath();
|
||||
BMath bm2;
|
||||
u_int64_t c1 = bm1.sum(1,2);
|
||||
|
||||
char* input[1024];
|
||||
std::string str=std::string();
|
||||
|
||||
for(int i=0; i<1024*1024*50; i++){
|
||||
BMath* bm2=new BMath();
|
||||
c1=c1+bm2->sum(c1,i);
|
||||
delete bm2;
|
||||
}
|
||||
|
||||
|
||||
blist<int> list = blist<int>();
|
||||
std::cout << "List size: " << list.getSize() <<std::endl;
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef BALHAU_CORE_BMATH
|
||||
#define BALHAU_CORE_BMATH
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace Core {
|
||||
namespace bmath {
|
||||
class BMath {
|
||||
public:
|
||||
BMath(){
|
||||
//std::cout << "Constructor BMath called" << std::endl;
|
||||
}
|
||||
u_int64_t sum(u_int64_t a,u_int64_t b){
|
||||
return a+b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
~BMath(){
|
||||
//std::cout<< "Destructor BMath called" << std::endl;
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
#endif
|
6
src/core/bmath/complex.cpp
Normal file
6
src/core/bmath/complex.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include "complex.hpp"
|
||||
|
||||
Core::Bmath::Complex::Complex(Long real,Long imaginary){
|
||||
this->real=real;
|
||||
this->imaginary=imaginary;
|
||||
};
|
21
src/core/bmath/complex.hpp
Normal file
21
src/core/bmath/complex.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef CORE_BMATH_COMPLEX
|
||||
#define CORE_BMATH_COMPLEX
|
||||
|
||||
#include "../cpu/types.hpp"
|
||||
|
||||
namespace Core{
|
||||
namespace Bmath{
|
||||
class Complex{
|
||||
private:
|
||||
Long real;
|
||||
Long imaginary;
|
||||
|
||||
public:
|
||||
Complex(Long real,Long imaginary);
|
||||
Complex& operator+=(const Complex& rightOp);
|
||||
friend Complex operator+(Complex leftOp,const Complex &rightOp);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue