Week #6: Improving siegelslopes, cspline1d, qspline1d, etc.

Xingyu-Liu
Published: 07/22/2021

What did you do this week?

  1. Look at the issue Is the r-value outputted by scipy.stats.linregress always the Pearson correlation coefficient?
  2. WIP: ENH: improve sort_vertices_of_regions via Pythran and made it more readable
    • Tyler said test_spherical_voronoi may test inplace sort, and it is not recommended to remove a test. In this way, we’ll never pass the test.
    • For the type error, I can’t reproduce it on my computer. Is it similar to the issue BUG: RBFInterpolator fails when calling it with a slice of a (1, n) array? I encountered similar `reshaped` issues before, and found that often the type is the problem while `reshaped` is not. Once I support that type, I’ll not get the error. But in the case there they do support that type.
    • 
                          TypeError: Invalid call to pythranized function `sort_vertices_of_regions(int32[:, :], int32 list list)'
                          Candidates are:
                              - sort_vertices_of_regions(int64[:,:], int64 list list)
                              - sort_vertices_of_regions(int32[:,:], int32 list list)
                              - sort_vertices_of_regions(int32[:,:], int64 list list)
                              - sort_vertices_of_regions(int[:,:], int list list)                    
                      
  3. Last week we concluded _spectral.pyx and _sosfilt.pyx are easy to be improved via Pythran, but later I found that _spectral.pyx already has a version in Pythran. For_sosfilt.pyx, I improved _sosfilt_float and leave _sosfilt_object in Cython. The performance for _sosfilt_float looks similar comparing Cython and Pythran. So I'm not sure whether I need to make a PR for it
  4. ENH: improve siegelslopes via pythran , 10x faster. If needed, I can also improve scipy/stats/_stats_mstats_common.py ’s linregress, theilslopes and put them with siegelslopes in the same file. But other two functions do not have obvious loops so here I only improve siegelslopes.
  5. ENH: improve cspline1d, qspline1d, and relative funcs via Pythran ,10x faster.
    • Segment fault on Azure pipelines. Because of calling itself in the function?
    • A lot of signatures. Any more concise way?
    • Actually, for those functions which have lots of signatures and also cause current segment faults - cspline1d_eval and qspline1d_eval , they don’t have many loops. I improved them because they are used to evaluate cspline1d and qspline1d , putting them in one file may look better. We can also leave them in the original file so that we won’t get above a.& b. problems

What is coming up next?

  1. Keep working on ENH: improve cspline1d, qspline1d, and relative funcs via Pythran
  2. Find more potential algorithms and improve them
  3. Make a PR for _sosfilt_float and comment on it
  4. keepdimsfeature support in Pythran

Did you get stuck anywhere?

I once said that np.expand_dims() does not support dim as keyword, I was wrong because the key is axis, but I still got the following error. However, np.expand_dims(x, 1) will work.

    (scipy-dev) charlotte@CHARLOTLIU-MB0 stats % pythran siegelslopes_pythran.py
    CRITICAL: I am in trouble. Your input file does not seem to match Pythran's constraints...
    siegelslopes_pythran.py:19:13 error: function uses an unknown (or unsupported) keyword argument `axis`
    ----
        deltax = np.expand_dims(x, axis=1) - x
                 ^~~~ (o_0)
    ----
     
    
DJDT

Versions

Time

Settings from gsoc.settings

Headers

Request

SQL queries from 1 connection

Static files (2312 found, 3 used)

Templates (11 rendered)

Cache calls from 1 backend

Signals

Log messages