Permalink
Browse files

Struggling with the filling -.-

  • Loading branch information...
1 parent 1f6d84a commit e76b3084f8e497adb26ad3ed285430efdc2b7dfa @eagle2com committed Feb 22, 2012
View
BIN LaplaceInverse.sdf
Binary file not shown.
View
BIN LaplaceInverse.suo
Binary file not shown.
View
2 LaplaceInverse/src/LinearSystem.cpp
@@ -63,7 +63,7 @@ void LinearSystem::DivideLine(int n, long double coef)
}
}
-inline void LinearSystem::Add(int n, int m, long double value)
+void LinearSystem::Add(int n, int m, long double value)
{
Set(n,m,Get(n,m) + value);
}
View
2 LaplaceInverse/src/LinearSystem.h
@@ -6,7 +6,7 @@ class LinearSystem
~LinearSystem(void);
inline const long double Get(int n, int m); // line, column
inline void Set(int n, int m, long double value);
- inline void Add(int n, int m,long double value);
+ void Add(int n, int m, long double value);
void Solve(void);
View
21 LaplaceInverse/src/TransferFunction.cpp
@@ -52,7 +52,7 @@ void TransferFunction::FindFactors(void)
denominator[i]->Print();
cout << endl;
cout << "We will need "<<denominator.size()<<" coefficients"<<endl;
- LinearSystem system(denominator.size()*2);
+ LinearSystem linear_system(denominator.size()*2);
ElementVec elems(denominator.size());
@@ -70,19 +70,14 @@ void TransferFunction::FindFactors(void)
for(int i = 0; i < denominator.size(); i++)
{
- int power = denominator[i]->GetMaxPower();
- if(power == 1)
+ for(int pow = 0; pow < denominator.size()*2-2;pow++) // -2: we ommit one factor
{
-
- }
- else if(power == 2)
- {
-
- }
- else
- {
- cout << "We have a higher than 2 power denominator, cannot solve, sorry :("<<endl;
- exit(1);
+ Literal* temp = elems[i]->Get(pow);
+ if(!temp)
+ continue;
+
+ linear_system.Add(pow+1,i*2,temp->coef);
+ linear_system.Add(pow,i*2+1,temp->coef);
}
}
}

0 comments on commit e76b308

Please sign in to comment.