Tag Info

New answers tagged


ParallelSum will get you some memory savings. I get a successful evaluation of the following: In[1]:= hugeList = Range[0, 6*10^3]; MemoryConstrained[ Apply[Plus, ParallelMap[N[Pi, 50]^#/#! &, hugeList]] - N[Pi, 50], 2^20 ] Out[1]= 19.999099979189475767266442984669044496068936843225 But, taking the range up to 7e3 ...


The OP correctly notes that Collect with Simplify is essential for computing this double sum in a reasonable amount of time, if at all. It is straightforward to find that the LeafCount of the inner sum only without using Collect is 721809. With it, the size of the inner sum drops to 21158. However, we can do much better. Instead, define the inner sum as ...


(Reposting my comment as an answer, just to take the question off the unanswered list) This is a bug and has been fixed in version 10.2. I am not aware of any workarounds that may be applicable in earlier versions.


As others have already stated, keeping the whole 70000x70000 matrix will require too much memory. Storing just the relevant information in a SparseArray will help. Let me create some sample data and define a distance function: nd = 70000; data = RandomReal[{0, 1}, {nd, 3}]; eps = 0.01; ed[i_, j_] := EuclideanDistance[data[[i]], data[[j]]] Now we need ...


Instead of a matrix, could you store only a list of the indices for which the distance is below your threshold? If there are relatively few of these, that would be efficient and easy to search.


Note: the answer below referred to a previous version of the question You may have more success with SparseArray. For instance: SparseArray[ {{i_, i_} -> 1, {i_, j_} /; Abs[i - j] == 1 -> 2}, {20000, 20000}, 0 ]; // RepeatedTiming (* Out: {0.21, Null} *) You would use patterns to assign values to positions within the matrix determined ...

Top 50 recent answers are included