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

Cannot change degree of a default Polynomial kernel #745

@philcontrolf1

Description

@philcontrolf1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions