Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

performance

Fast arbitrary distribution random sampling (inverse transform sampling)

August 13, 2022 by Magenaut

The random module (http://docs.python.org/2/library/random.html) has several fixed functions to randomly sample from. For example random.gauss will sample random point from a normal distribution with a given mean and sigma values.

Categories Python, Q&A Tags performance, python, random Leave a comment

Efficiently Calculating a Euclidean Distance Matrix Using Numpy

August 12, 2022 by Magenaut

I have a set of points in 2-dimensional space and need to calculate the distance from each point to each other point.

Categories Python, Q&A Tags euclidean-distance, matrix, numpy, performance, python Leave a comment

Why Python is so slow for a simple for loop?

August 12, 2022 by Magenaut

We are making some kNN and SVD implementations in Python. Others picked Java. Our execution times are very different. I used cProfile to see where I make mistakes but everything is quite fine actually. Yes, I use numpy also. But I would like to ask simple question.

Categories Python, Q&A Tags jit, performance, python Leave a comment

Max in a sliding window in NumPy array

August 12, 2022 by Magenaut

I want to create an array which holds all the max()es of a window moving through a given numpy array. I’m sorry if this sounds confusing. I’ll give an example. Input:

Categories Python, Q&A Tags max, numpy, performance, python, scipy Leave a comment

Efficient way to take the minimum/maximum n values and indices from a matrix using NumPy

August 12, 2022 by Magenaut

What’s an efficient way, given a NumPy matrix (2D array), to return the minimum/maximum n values (along with their indices) in the array?

Categories Python, Q&A Tags numpy, optimization, performance, python Leave a comment

Performance Advantages to Iterators?

August 12, 2022 by Magenaut

What (if any) performance advantages are offered by using iterators. It seems like the ‘Right Way’ to solve many problems, but does it create faster/more memory-conscious code? I’m thinking specifically in Python, but don’t restrict answers to just that.

Categories Python, Q&A Tags iterator, performance, python Leave a comment

Python Slice Assignment Memory Usage

August 12, 2022 by Magenaut

I read in a comment here on Stack Overflow that it is more memory efficient to do slice assignment when changing lists. For example,

Categories Python, Q&A Tags benchmarking, memory-management, performance, python Leave a comment

Complexity of list.index(x) in Python

August 12, 2022 by Magenaut

I’m referring to this: http://docs.python.org/tutorial/datastructures.html

Categories Python, Q&A Tags algorithm, big-o, list, performance, python Leave a comment

Can I perform dynamic cumsum of rows in pandas?

August 12, 2022 by Magenaut

If I have the following dataframe, derived like so: df = pd.DataFrame(np.random.randint(0, 10, size=(10, 1)))

Categories Python, Q&A Tags numba, pandas, performance, python Leave a comment

Efficiently detect sign-changes in python

August 12, 2022 by Magenaut

I want to do exactly what this guy did:

Categories Python, Q&A Tags math, numpy, performance, python Leave a comment
Older posts
Newer posts
← Previous Page1 … Page12 Page13 Page14 … Page20 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress