Skip to content

Latest commit

 

History

History
63 lines (35 loc) · 913 Bytes

File metadata and controls

63 lines (35 loc) · 913 Bytes

AVX Complex Class

About

Pure lean and fast complex arithmetic using AVX2 vector unit. Almost double performance by parallel processing.

Copyright (c) 2014-2018 Joshua Dentoyan

Overview

The class provides basic complex operations including addition, subtraction, multiplication, division etc.

Build

g++ -mavx2 -o complex_test complex_test.cpp

Usage

The header only complex.h should be inluded in the main module.

#include "complex.h"
#include <iostream>
#include <cmath>


int main()
{
    Complex a(3.0, 8.0);
    Complex b(2.0, 1.0);

    Complex p = a * b;
    std::cout << "a*b=";
    p.write(std::cout);
    std::cout << " abs=" << p.abs() << std::endl;

    Complex d = a / b;
    std::cout << "a/b=";
    d.write(std::cout);
    std::cout << " abs=" << d.abs() << std::endl;

    return 0;
}

License

LGPLv3+.


EOF