Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 76626

Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

2 votes
2 answers
56 views

Get list of indices from searching for values in list of lists

Performance is an issue def get_indices(list_of_lists): indices = [0]*len([n for l in list_of_lists for n in l]) for i in range(len(indices)): indices[i] = [ k for k,n in enumerate(list_of_lists …
C_Z_'s user avatar
  • 521
4 votes
1 answer
819 views

Randomly split a vector into N bins of random lengths

Performance does matter, so I'm wondering if I should initialize the empty bins outside of the function. …
C_Z_'s user avatar
  • 521
3 votes
2 answers
23k views

Efficiently index rows of numpy array by exclusion

I need a function that takes a numpy array and a row number as inputs and returns the array (or copy of the array) excluding the given row. I want to do this as efficiently as possible. # Test array …
C_Z_'s user avatar
  • 521
2 votes

Efficiently index rows of numpy array by exclusion

I was able to come up with a function that uses np.take that runs faster than the list method. def index_rows_by_exclusion_nptake(arr, i): """ Return copy of arr excluding single row of posit …
C_Z_'s user avatar
  • 521
5 votes
5 answers
356 views

Create matrices of a certain format

I need to create matrices that follow a specific format: the matrix is a square NxN matrix and the off-diagonals all have the same value (param) and the diagonals have values such that the rows sum to …
C_Z_'s user avatar
  • 521
6 votes
1 answer
13k views

Create symmetrical matrix from list of values

I need to make a matrix (in the form of a numpy array) by taking a list of parameters of length N and returning an array of dimensions N+1 x N+1 where the off-diagonals are symmetric and each triangle …
C_Z_'s user avatar
  • 521