Skip to content
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

Error in converting large array using #63

Closed
binoyp opened this issue Sep 9, 2020 · 3 comments
Closed

Error in converting large array using #63

binoyp opened this issue Sep 9, 2020 · 3 comments
Labels
bug Something isn't working Windows Effects Windows

Comments

@binoyp
Copy link

binoyp commented Sep 9, 2020

For the following code

SectionPolygon::SectionPolygon(const int &npt, const py::array_t<double> &mat) {

// Following Code Works:
//     auto r = mat.unchecked<2>(); // mat must have ndim = 2; 
//    points = arma::mat(r.shape(0), r.shape(1));
//        for (ssize_t i = 0; i < r.shape(0); i++)
//            for (ssize_t j = 0; j < r.shape(1); j++)
//                points(i,j) = r(i,j);




    nPoints = npt;
    points = carma::arr_to_mat<double>(mat);  // Causes Error

}

Inputs : pts shape is (535,2)

 pts =np.array([
	[-121.15449157, 7.08765441],
	[-118.16564981, 6.51760372],
	[-115.14766845, 5.98635615],
	[-112.10806889, 5.49655813],
	[-109.05437256, 5.05085610],
	[-105.99410086, 4.65189652], .....])

pol = SectionPolygon(pts.shape[0], pts)

res = pol.AreaCentroid()
pol.PrintPoints()

Output

Polygon Points:
  1.2513e-311   7.0877e+00
  1.2513e-311   6.5176e+00
  -1.1515e+02   5.9864e+00
   ....

there are error in first element of first and second row.

There are no issues for smaller numpy arrays.

Compiler used is Visual Studio 2019

@RUrlus RUrlus added bug Something isn't working Windows Effects Windows labels Sep 9, 2020
@RUrlus
Copy link
Owner

RUrlus commented Sep 9, 2020

Thanks for the report, I tried reproducing locally, MacOS, just now but can't reproduce. I'll add bigger samples to the test run later this week.

In the mean time could you try and run the tests by adding-DBUILD_TESTS=true and running pytest in the build directory?
If you could increase the sample size in tests/arr_to_mat for the functions test_arr_to_mat_double and test_arr_to_mat_double_c_contiguous that would be much appreciated.

@RUrlus
Copy link
Owner

RUrlus commented Oct 4, 2020

Could be due to the same underlying cause as #67

@RUrlus
Copy link
Owner

RUrlus commented Mar 19, 2021

Resolved in b159447

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Windows Effects Windows
Projects
None yet
Development

No branches or pull requests

2 participants