110 questions linked to/from What is a Mathematica packed array?
133k 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 ...
5k 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 ...
7k 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 ...
6k 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 ...
5k 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 ...
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 ...
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 : ...
2k views

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

Why is Plus so much slower than Total for summing lists? ...
4k 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?
4k 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 ...
1k views

### How can I define a very large matrix efficiently?

Here's a 7x7 matrix: ...
3k 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: ...
889 views

### Substitute some 1s with 0s in random list

How is it better to substitute list of random combination of 1 and 0 (binary image) so that only first (or central) instance of 1 left in each group. ...