|
a = np.insert(a,len(a),m) |
Hi 👋 I noticed this line in the code:
a = np.insert(a, len(a), m)
This can be simplified and optimized as:
a = np.append(a, m)
- np.append is explicitly designed for appending values to an array.
- np.insert performs additional index validation and is intended for arbitrary insertion.
- Benchmarks show that append is up to 2–3× faster and more memory efficient.
- Improves both clarity and performance, especially in loops.
MEMD-Python-/MEMD_all.py
Line 387 in 4aa72f5
Hi 👋 I noticed this line in the code:
a = np.insert(a, len(a), m)This can be simplified and optimized as:
a = np.append(a, m)