Changes between Version 22 and Version 23 of SwiggingHlsvd


Ignore:
Timestamp:
Jul 14, 2009, 4:54:20 PM (10 years ago)
Author:
flip
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SwiggingHlsvd

    v22 v23  
    101101#!rst
    102102The code to call an ideal Python version of ``hlsvd()`` might look something like the example below. (For clarity's sake I'm sticking with the same variable names as in the comments above; I generally prefer to avoid abbreviations.)
    103 ::
    104 
     103}}}
     104
     105{{{
     106#!python
    105107    # - y is an iterable type (e.g. a list) of complex numbers. Complex
    106108    # numbers are a native type in Python.
     
    113115    # - snoise, rms, nitf and ndiv are floats or ints as appropriate
    114116    root, fre, dam, amp, phase, sv, snoise, rms, nitf, ndiv = return_tuple
    115 
    116 
     117}}}
     118
     119{{{
     120#!rst
    117121This code has several advantages over the C version. For starters, the input and output parameters are clearly separated which makes the code easier to read. Second, since complex numbers are a native type in Python, there's no need to represent them as two correlated lists of floats. That makes the input parameter y and the output parameter root simpler to read and manipulate. It also eliminates the possibility of a mismatched list-size bug (i.e. if a different number of real and imaginary values are supplied). Yet another advantage is that we can eliminate one parameter (ndata) that can be inferred from ``len(y)``.
    118122