-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Math.Net dependency #7
Comments
I think you can remove Math.Net dependency with two approaches as @wo80 mentioned. First is a wrapper around |
yeah, Ill have a look which one is the best :) !! Pull-request is comming :P ! |
I'd suggest to use arrays and keep the implementation private. To optimize performance, you could then introduce very specific functions like static class VectorHelper
{
/// <summary>
/// target = v + scalew * w + scalez * z.
/// </summary>
public static void Add(int n, double[] v, double scalew, double[] w, double scalez, double[] z, double[] target)
{
for (int i = 0; i < n; i++)
{
target[i] = v[i] + scalew * w[i] + scalez * z[i];
}
}
} The above example equation would then be written as using static VectorHelper;
// equilibrium = info.InitialLoad + newState.Lambda * info.ReferenceLoad - reaction;
Add(equilibrium.Length, info.InitialLoad, newState.Lambda, info.ReferenceLoad, -1.0, reaction, equilibrium); |
Hello, Thanks |
Sure!! Im on vacations and wont start untill next week |
Hey @epsi1on ! Did you manage to do something? If not I can work on that. Have a good day! |
Hi, |
@EduardBargues Removing the Math.NET dependency would be great. You could either use arrays like CSparse.NET (see Vector helper class) or implement a simple vector type which wraps a double array.
@epsi1on The ILinearSolver allows to choose whichever matrix implementation you like and the goal is to be completely independend of any third party library.
EDIT: introducing an array pool is a good idea, but might not be necessary. To eliminate the cloning of the array in the example code above, the Corrector would need to have a working array of the appropriate size (which could be initialized when the NonLinearSolver is built):
// equilibrium array/vector is a class member
info.InitialLoad.CopyTo(equilibrium);
equilibrium.Add(newState.Lambda, info.ReferenceLoad, equilibrium);
equilibrium.Add(-1.0, reaction, equilibrium);
The text was updated successfully, but these errors were encountered: