HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/sklearn/utils/_weight_vector.pxd.tp
{{py:

"""
Efficient (dense) parameter vector implementation for linear models.

Template file for easily generate fused types consistent code using Tempita
(https://github.com/cython/cython/blob/master/Cython/Tempita/_tempita.py).

Generated file: weight_vector.pxd

Each class is duplicated for all dtypes (float and double). The keywords
between double braces are substituted in setup.py.
"""

# name_suffix, c_type
dtypes = [('64', 'double'),
          ('32', 'float')]

}}

{{for name_suffix, c_type in dtypes}}

cdef class WeightVector{{name_suffix}}(object):
    cdef readonly {{c_type}}[::1] w
    cdef readonly {{c_type}}[::1] aw
    cdef {{c_type}} *w_data_ptr
    cdef {{c_type}} *aw_data_ptr

    cdef double wscale
    cdef double average_a
    cdef double average_b
    cdef int n_features
    cdef double sq_norm

    cdef void add(self, {{c_type}} *x_data_ptr, int *x_ind_ptr,
                  int xnnz, {{c_type}} c) noexcept nogil
    cdef void add_average(self, {{c_type}} *x_data_ptr, int *x_ind_ptr,
                          int xnnz, {{c_type}} c, {{c_type}} num_iter) noexcept nogil
    cdef {{c_type}} dot(self, {{c_type}} *x_data_ptr, int *x_ind_ptr,
                    int xnnz) noexcept nogil
    cdef void scale(self, {{c_type}} c) noexcept nogil
    cdef void reset_wscale(self) noexcept nogil
    cdef {{c_type}} norm(self) noexcept nogil

{{endfor}}