• Kirill Smelkov's avatar
    bigarray: In-place .append() · 1245acc9
    Kirill Smelkov authored
    ca064f75 (bigarray: Support resizing in-place) added O(1) in-place
    BigArray.resize() which makes possible for users to append data to BigArray in
    O(δ) time.
    
    But it is easy for people to make off-by-one mistakes when calculating
    indices for append.
    
    So provide a convenient BigArray.append() which simplifies the following
    
        A                               # ZBigArray e.g. of shape       (N, 3)
        values                          # ndarray to append of shape    (δ, 3)
        n, δ = len(A), len(values)      # length of A's major index  =N
        A.resize((n+δ, A.shape[1:]))    # add δ new entries ; now len(A) =N+δ
        A[-δ:] = values                 # set data for last new δ entries
    
    into
    
        A.append(values)
    
    /cc @klaus
    1245acc9
Name
Last commit
Last update
3rdparty Loading commit data...
bigarray Loading commit data...
bigfile Loading commit data...
demo Loading commit data...
include/wendelin Loading commit data...
lib Loading commit data...
t Loading commit data...
.gitignore Loading commit data...
.gitmodules Loading commit data...
CHANGES Loading commit data...
COPYING Loading commit data...
Makefile Loading commit data...
setup.py Loading commit data...
tox.ini Loading commit data...
wendelin.py Loading commit data...