Skip to content

Instantly share code, notes, and snippets.

@terakun
Created December 4, 2016 15:52
Show Gist options
  • Save terakun/9d59eed29e3b607626bae5180c92502d to your computer and use it in GitHub Desktop.
Save terakun/9d59eed29e3b607626bae5180c92502d to your computer and use it in GitHub Desktop.
DKA method
#include <iostream>
#include <complex>
#include <vector>
#include <iomanip>
using complexd=std::complex<double>;
void showpoly(const std::vector<double> &coeffs);
complexd poly(const std::vector<double> &coeffs,const complexd &z);
void DKA(const std::vector<double> &coeffs,std::vector<complexd> &poles);
double binary(const std::vector<double> &coeffs);
int main(){
int n;
std::cout<<"degree:";
std::cin>>n;
std::vector<double> coeffs(n);
for(auto &c:coeffs)
std::cin>>c;
showpoly(coeffs);
std::cout<<"=0"<<std::endl;
return 0;
}
void showpoly(const std::vector<double> &coeffs){
int n = coeffs.size();
std::cout<<"x^"<<n;
for(int i=0;i<n;i++){
std::cout<<std::showpos<<coeffs[i]<<"x^"<<std::noshowpos<<n-i-1;
}
}
complexd poly(const std::vector<double> &coeffs,complexd &z){
complexd q=0;
}
void DKA(const std::vector<double> &coeffs,std::vector<complexd> &poles){
int n=coeffs.size();
std::vector<complexd> tmppoles(n);
double r = binary(coeffs);
for(int i=0;i<n;++i){
// tmppoles[i] = -coeffs[i]/n + r*std::exp(
}
//iteration
}
double binary(const std::vector<double> &coeffs){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment