Execution failures

Execution failures

This contrived code, boiled down from something that should work:

void my_call(dense &Out, const usize &Ncol)
#define NCOL 5 // OK
//#define NCOL 35000 // freezes (not inf. loop)
//#define NCOL 7*Ncol // Win7 says "process stopped working"

dense v = fill(2.f, NCOL, 3);
dense a(NCOL, 2);

a = replace_row(a, 0, sqrt(v.row(0)) + sqrt(v.row(1)));
a = replace(a, 0, NCOL, 1, 1, v);
Out = a.row(0);

...actually does work with the 1st #define. Using the 2nd #define produces an executable that freezes (0% proc. time). Using the 3rd #define, and calling with Ncol = 5000, produces an executable that Win7 says "process has stopped working".

Why am I so lucky?

- paul

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


Apparently, this is an issue with the replace_row() or the replace() API. I was able to reproduce the same problem on both Windows and Linux. A bug report has been filed. Thanks for reporting this issue!


I've used replace_row()on its own,some,as well asreplace()for vectors without problems so I suspect replace() for 2D containers.

What I'm hunting for is individual, partial row replacement in 2D containers and thought to have the replacing data as a 2D container with only one row. Replacing the entire row is less efficient. Is this a good approach, or would you suggest something else?

- paul

Leave a Comment

Please sign in to add a comment. Not a member? Join today