I have a large dataset in a single file, consisting of one positive integer per line. The file is more than 20GB in size, and before I do anything with the data I need to validate that everything is as I expect it. For this, I need to check that the number on line $n$ is always strictly greater than the one on line $n-1$.
How can I achieve this in an efficient manner?
This is how I am loading the file into memory:
(* Load the data file *)
SetDirectory[NotebookDirectory[]];
Print[DateString[], " - Loading dataset..."]
dataset = ReadList["dataset.txt"];
And I can simply access the element at index $i$ with
dataset[[i]]
Thanks!
PS. I am using Mathematica 11.1 and I have a lot of RAM, so space is not an issue.
OpenReadandReadto digest data line by line. Would something like that help? – rhermans Dec 08 '22 at 10:24d = {4, 2, 3, 4}yourAllTruereturnsTrueinstead ofFalse. – Edmund Dec 08 '22 at 22:59d = {4, 2, 3, 4}; AllTrue[Transpose[{Rest[d], Most[d]}], Greater @@ ## &]– Daniel Huber Dec 09 '22 at 09:21