403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/sympy/discrete/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/sympy/discrete/__pycache__/transforms.cpython-310.pyc
o

�8Va�-�@sdZddlmZmZmZddlmZmZddlm	Z	ddl
mZmZddl
mZmZddlmZmZddlmZd$d
d�Zd%d
d�Zd%dd�Zeje_d$dd�Zdd�Zdd�Zeje_d$dd�Zdd�Zdd�Zeje_dd�Zd&d d!�Zd&d"d#�Z eje _dS)'zd
Discrete Fourier Transform, Number Theoretic Transform,
Walsh Hadamard Transform, Mobius Transform
�)�S�Symbol�sympify)�as_int�iterable)�
expand_mul)�pi�I)�sin�cos)�isprime�primitive_root)�ibinFc
st|�std��dd�|D�}tdd�|D��rtd��t|���dkr&|S���d}��d@r:|d7}d|�|tjg�t|�7}td��D]"}t	t
||d	d
�ddd�d�}||krm||||||<||<qK|rvd
t�ndt���dur����d���fdd�t�d�D�}d}|�kr�|d�|}	}
td�|�D]3}t|	�D],}|||t
||||	||
|�}}|||||||<||||	<q�q�|d9}|�ks�|r��dur���fdd�|D�n�fdd�|D�}|S)z3Utility function for the Discrete Fourier TransformzAExpected a sequence of numeric coefficients for Fourier TransformcS�g|]}t|��qS��r��.0�argrr�;/usr/lib/python3/dist-packages/sympy/discrete/transforms.py�
<listcomp>�z&_fourier_transform.<locals>.<listcomp>css�|]}|�t�VqdS�N)�hasr�r�xrrr�	<genexpr>s�z%_fourier_transform.<locals>.<genexpr>z"Expected non-symbolic coefficients��T��strN������cs(g|]}t�|�tt�|��qSr)rr	r
)r�i)�angrrr4s(rcsg|]	}|�����qSr)�evalfr)�dps�nrrr@sc�g|]}|��qSrrr�r'rrrAr)r�	TypeError�any�
ValueError�len�
bit_lengthr�Zero�range�intrrr%r)
�seqr&�inverse�a�br#�j�w�h�hf�ut�u�vr)r$r&r'r�_fourier_transformsJ�.(���r=NcC�t||d�S)al
    Performs the Discrete Fourier Transform (**DFT**) in the complex domain.

    The sequence is automatically padded to the right with zeros, as the
    *radix-2 FFT* requires the number of sample points to be a power of 2.

    This method should be used with default arguments only for short sequences
    as the complexity of expressions increases with the size of the sequence.

    Parameters
    ==========

    seq : iterable
        The sequence on which **DFT** is to be applied.
    dps : Integer
        Specifies the number of decimal digits for precision.

    Examples
    ========

    >>> from sympy import fft, ifft

    >>> fft([1, 2, 3, 4])
    [10, -2 - 2*I, -2, -2 + 2*I]
    >>> ifft(_)
    [1, 2, 3, 4]

    >>> ifft([1, 2, 3, 4])
    [5/2, -1/2 + I/2, -1/2, -1/2 - I/2]
    >>> fft(_)
    [1, 2, 3, 4]

    >>> ifft([1, 7, 3, 4], dps=15)
    [3.75, -0.5 - 0.75*I, -1.75, -0.5 + 0.75*I]
    >>> fft(_)
    [1.0, 7.0, 3.0, 4.0]

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm
    .. [2] http://mathworld.wolfram.com/FastFourierTransform.html

    )r&�r=�r2r&rrr�fftFs.rAcC�t||dd�S)NT)r&r3r?r@rrr�ifftw�rCcs0t|�std��t|��t��std���fdd�|D�}t|�}|dkr'|S|��d}||d@r;|d7}d|}�d|rEtd��|dg|t|�7}td|�D]"}tt	||d	d
�ddd�d�}||krw||||||<||<qUt
��}t|�d|��}	|r�t|	�d��}	dg|d}
td|d�D]}|
|d|	�|
|<q�d}||k�r|d||}}
td||�D]5}t|�D].}||||||||
|
|}}||�||�|||<||||<q�q�|d9}||ks�|�rt|�d�����fd
d�|D�}|S)z3Utility function for the Number Theoretic TransformzJExpected a sequence of integer coefficients for Number Theoretic Transformz5Expected prime modulus for Number Theoretic Transformcsg|]}t|���qSr)rr)�prrr��z/_number_theoretic_transform.<locals>.<listcomp>rrz/Expected prime modulus of the form (m*2**k + 1)rTrNr!csg|]}|���qSrrr�rE�rvrrr�rF)rr*rrr,r-r.r0r1rr
�pow)r2�primer3r4r'r5r#r6�pr�rtr7r8r9r:r;r<rrGr�_number_theoretic_transform�sT�
*0��rMcCr>)aQ
    Performs the Number Theoretic Transform (**NTT**), which specializes the
    Discrete Fourier Transform (**DFT**) over quotient ring `Z/pZ` for prime
    `p` instead of complex numbers `C`.

    The sequence is automatically padded to the right with zeros, as the
    *radix-2 NTT* requires the number of sample points to be a power of 2.

    Parameters
    ==========

    seq : iterable
        The sequence on which **DFT** is to be applied.
    prime : Integer
        Prime modulus of the form `(m 2^k + 1)` to be used for performing
        **NTT** on the sequence.

    Examples
    ========

    >>> from sympy import ntt, intt
    >>> ntt([1, 2, 3, 4], prime=3*2**8 + 1)
    [10, 643, 767, 122]
    >>> intt(_, 3*2**8 + 1)
    [1, 2, 3, 4]
    >>> intt([1, 2, 3, 4], prime=3*2**8 + 1)
    [387, 415, 384, 353]
    >>> ntt(_, prime=3*2**8 + 1)
    [1, 2, 3, 4]

    References
    ==========

    .. [1] http://www.apfloat.org/ntt.html
    .. [2] http://mathworld.wolfram.com/NumberTheoreticTransform.html
    .. [3] https://en.wikipedia.org/wiki/Discrete_Fourier_transform_(general%29

    )rJ�rM�r2rJrrr�ntt�s(rPcCrB)NT)rJr3rNrOrrr�intt�rDrQc	st|�std��dd�|D�}t|���dkr|S��d@r%d����|tjg�t|�7}d}|�kru|d}td�|�D]+}t|�D]$}|||||||}}|||||||<||||<qGqA|d9}|�ks7|r��fdd�|D�}|S)z1Utility function for the Walsh Hadamard Transformz@Expected a sequence of coefficients for Walsh Hadamard TransformcSrrrrrrrr�rz-_walsh_hadamard_transform.<locals>.<listcomp>rrrcr(rrrr)rrrr�rr*r-r.rr/r0)	r2r3r4r8r9r#r6r;r<rr)r�_walsh_hadamard_transform�s,(��rScCst|�S)aN
    Performs the Walsh Hadamard Transform (**WHT**), and uses Hadamard
    ordering for the sequence.

    The sequence is automatically padded to the right with zeros, as the
    *radix-2 FWHT* requires the number of sample points to be a power of 2.

    Parameters
    ==========

    seq : iterable
        The sequence on which WHT is to be applied.

    Examples
    ========

    >>> from sympy import fwht, ifwht
    >>> fwht([4, 2, 2, 0, 0, 2, -2, 0])
    [8, 0, 8, 0, 8, 8, 0, 0]
    >>> ifwht(_)
    [4, 2, 2, 0, 0, 2, -2, 0]

    >>> ifwht([19, -1, 11, -9, -7, 13, -15, 5])
    [2, 0, 4, 0, 3, 10, 0, 0]
    >>> fwht(_)
    [19, -1, 11, -9, -7, 13, -15, 5]

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Hadamard_transform
    .. [2] https://en.wikipedia.org/wiki/Fast_Walsh%E2%80%93Hadamard_transform

    �rS�r2rrr�fwhts$rVcCst|dd�S)NT)r3rTrUrrr�ifwht:srWcCst|�std��dd�|D�}t|�}|dkr|S||d@r%d|��}|tjg|t|�7}|r\d}||krZt|�D]}||@rQ||||||A7<q=|d9}||ks9|Sd}||kr�t|�D]}||@rmqf||||||A7<qf|d9}||ksb|S)z\Utility function for performing Mobius Transform using
    Yate's Dynamic Programming methodz#Expected a sequence of coefficientscSrrrrrrrrMrz%_mobius_transform.<locals>.<listcomp>rrrR)r2�sgn�subsetr4r'r#r6rrr�_mobius_transformFs8����rZTcC�t|d|d�S)a

    Performs the Mobius Transform for subset lattice with indices of
    sequence as bitmasks.

    The indices of each argument, considered as bit strings, correspond
    to subsets of a finite set.

    The sequence is automatically padded to the right with zeros, as the
    definition of subset/superset based on bitmasks (indices) requires
    the size of sequence to be a power of 2.

    Parameters
    ==========

    seq : iterable
        The sequence on which Mobius Transform is to be applied.
    subset : bool
        Specifies if Mobius Transform is applied by enumerating subsets
        or supersets of the given set.

    Examples
    ========

    >>> from sympy import symbols
    >>> from sympy import mobius_transform, inverse_mobius_transform
    >>> x, y, z = symbols('x y z')

    >>> mobius_transform([x, y, z])
    [x, x + y, x + z, x + y + z]
    >>> inverse_mobius_transform(_)
    [x, y, z, 0]

    >>> mobius_transform([x, y, z], subset=False)
    [x + y + z, y, z, 0]
    >>> inverse_mobius_transform(_, subset=False)
    [x, y, z, 0]

    >>> mobius_transform([1, 2, 3, 4])
    [1, 3, 4, 10]
    >>> inverse_mobius_transform(_)
    [1, 2, 3, 4]
    >>> mobius_transform([1, 2, 3, 4], subset=False)
    [10, 6, 7, 4]
    >>> inverse_mobius_transform(_, subset=False)
    [1, 2, 3, 4]

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/M%C3%B6bius_inversion_formula
    .. [2] https://people.csail.mit.edu/rrw/presentations/subset-conv.pdf
    .. [3] https://arxiv.org/pdf/1211.0189.pdf

    r�rXrY�rZ�r2rYrrr�mobius_transformls8r_cCr[)Nr!r\r]r^rrr�inverse_mobius_transform�rDr`)Fr)T)!�__doc__�
sympy.corerrr�sympy.core.compatibilityrr�sympy.core.functionr�sympy.core.numbersrr	�(sympy.functions.elementary.trigonometricr
r�
sympy.ntheoryrr
�sympy.utilities.iterablesrr=rArCrMrPrQrSrVrWrZr_r`rrrr�<module>s0
	
1
1
	:+
	'	
&
:

Youez - 2016 - github.com/yon3zu
LinuXploit