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.

IndexOutOfRangeException exception in Matrix class, .First method when using lambda #696

@bebenins

Description

@bebenins

Hello,
I think this should be gracefully handled in .First method.
Here's what I have...

I need to find an index of a specific Point.X in an array of Points. So I use this expression:

    double myX = 700;
    int index = fft.First(p => p.X >= myX);

It works just fine if myX isn't grater than the maximum Point.X in fft array. But if my fft array Point.X is less than myX, I get an exception:

System.IndexOutOfRangeException occurred
HResult=-2146233080
Message=Index was outside the bounds of the array.
Source=Accord.Math
StackTrace:
at Accord.Math.Matrix.First[T](T[] data, Func`2 func)
InnerException:

What is the easiest/elegant "patch" I can do for now?
Thank you!

Edit: Just in case, this is using Accord.Math 3.4.0.0

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