Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Cannot change degree of a default Polynomial kernel #745

Closed
philcontrolf1 opened this issue Aug 1, 2017 · 3 comments
Closed

Cannot change degree of a default Polynomial kernel #745

philcontrolf1 opened this issue Aug 1, 2017 · 3 comments

Comments

@philcontrolf1
Copy link

Once a Polynomial kernel has been created with the default degree of zero, this can never be changed. Trivial example:

public static void Main(string[] args)
{
    var polynomial = new Polynomial();
    polynomial.Degree = 3;
}

Expected result: polynomial degree is changed to 3 as that is a valid value.
Actual result: System.ArgumentOutOfRangeException 'Degree must be positive'

Fairly obviously being caused by the check at Polynomial.cs:72:

if (degree <= 0)
    throw new ArgumentOutOfRangeException("value", "Degree must be positive.");

and the obvious fix would be to make the check be on value (the new value) rather than degree (the old value). I'll make a PR if you want one, but doesn't really seem worth it for such a small change.

@cesarsouza
Copy link
Member

Hi @philcontrolf1,

Thanks a lot for opening the issue. Indeed, that was a silly mistake, probably originated by copying and pasting from a previous argument check coming from the class constructor's body.

I will commit a fix soon. If you find any other similar issues, please let me know.

Regards,
Cesar

@cesarsouza
Copy link
Member

A new pre-release package (3.6.4-alpha) has just been uploaded to NuGet. It should contain a fix for this issue.

@cesarsouza
Copy link
Member

Added in 3.7.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants