135 questions linked to/from What is a Mathematica packed array?
70 views

### Packed/Unpacked array - what object/like 0 or 1?/how to check/ [duplicate]

In Mathematica, there is a concept called packed array. ...
• 4,315
157k views

### Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
7k views

### Partitioning with varying partition size

How can I partition a list into partitions whose sizes vary? The length of the $k$'th partition is a function $f(k)$. For example: if $l = \{1, 2, 3, 4, 5, 6\}$ and $f(k) = k$. Then the partitioning ...
• 7,777
11k views

### Generating a list of numbers that are not multiples of 4

I want to write simple code that will list all numbers from $1$ to $n$ that are not multiples of $4$. And in this case I consider that ...
• 433
11k views

### How to implement the general array broadcasting method from NumPy?

A friend of mine introduced array broadcasting in the Python NumPy package which is very convenient (and also highly efficient). The idea is perfectly shown in this ...
• 17.2k
2k views

### Speed up Do loops in MMA 13.0

How to speed up Do loop in MMA 13. We consider the following Benchmark test (4 kernels, i7, win10): In MMA 13: ...
• 1,856
7k views

### Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
• 236k
2k views

### Are there guidelines for avoiding the unpacking of a packed array?

Packed arrays are very useful because they save memory and generally allow speedier and more efficient calculation times. If a list of data currently stored as a packed array is unpacked, it can slow ...
• 34.3k
1k views

### Efficient conditional Mean[] on a large data set

Consider a list, AK6, that has 382 sublists of length varying from 2500 to 3000. Each "subsublist" is as such : ...
• 5,599
912 views

### Iterate over # without needing to define a variable

I want a function that takes in a number $n_0$ and a list $\{n_1, n_2, n_3, n_4, n_5\}$ and returns $\{\{n_0,n_1\},\{n_0,n_2\}, \{n_0,n_3\},... \}$. The reason I want this is to use it in Map, so I ...
• 578
5k views

### Why won't Parallelize speed up my code?

What reasons are there that can cause parallelized Mathematica code not to run with full performance?
• 236k
3k views

### Why is Plus so much slower than Total?

Why is Plus so much slower than Total for summing lists? ...
7k views

### How to zero (or replace) the diagonal of a square matrix?

Zeroing the diagonal of a square matrix is an operation I need frequently, but somehow I still haven't managed to find an elegant solution that satisfies all these requirements: works with both ...
• 236k
4k views

### Dramatic speed difference of code on MATLAB and Mathematica

Background: I was trying to convert a MATLAB code (fluid simulation, SPH method) into a Mathematica one, but the speed difference is huge. MATLAB code: ...
• 326