NTPoly
Functions/Subroutines
sparsevectormodule Module Reference

A module for handling compressed vectors. Compressed vectors are stored in two lists. The first is a list of indices, the second a list of values. This module can add two of those vectors together. More...

Functions/Subroutines

pure subroutine, public addsparsevectors (inner_index_a, values_a, inner_index_b, values_b, inner_index_c, values_c, total_values_c, alpha_in, threshold_in)
 Add together two sparse vectors. C = A + alpha*B. More...
 
pure real(ntreal) function, public dotsparsevectors (inner_index_a, values_a, inner_index_b, values_b)
 product = dot(A,B) More...
 
pure subroutine, public pairwisemultiplyvectors (inner_index_a, values_a, inner_index_b, values_b, inner_index_c, values_c, total_values_c)
 Pairwise Multiply Vectors C = A Mult B. More...
 

Detailed Description

A module for handling compressed vectors. Compressed vectors are stored in two lists. The first is a list of indices, the second a list of values. This module can add two of those vectors together.

Function/Subroutine Documentation

◆ addsparsevectors()

pure subroutine, public sparsevectormodule::addsparsevectors ( integer, dimension(:), intent(in)  inner_index_a,
real(ntreal), dimension(:), intent(in)  values_a,
integer, dimension(:), intent(in)  inner_index_b,
real(ntreal), dimension(:), intent(in)  values_b,
integer, dimension(:), intent(out)  inner_index_c,
real(ntreal), dimension(:), intent(out)  values_c,
integer, intent(out)  total_values_c,
real(ntreal), intent(in), optional  alpha_in,
real(ntreal), intent(in), optional  threshold_in 
)

Add together two sparse vectors. C = A + alpha*B.

Parameters
[in]inner_index_alist of indices for A.
[in]values_alist of values for A.
[in]inner_index_blist of indices for B.
[in]values_blist of values for B.
[out]inner_index_clist of indices computed for C.
[out]values_clist of values computed for C.
[out]total_values_cthis is the total number of values in C.
[in]alpha_invalue to scale VecB by. Optional, default is 1.0.
[in]threshold_infor flushing values to zero. Default value is 0.0. The values that are returned for C are only valid in the range (1:total_values_c). We do not do an automatic shrinking of the array to keep this routine low in overhead.
Todo:
in principal this can be done without any branching.

◆ dotsparsevectors()

pure real(ntreal) function, public sparsevectormodule::dotsparsevectors ( integer, dimension(:), intent(in)  inner_index_a,
real(ntreal), dimension(:), intent(in)  values_a,
integer, dimension(:), intent(in)  inner_index_b,
real(ntreal), dimension(:), intent(in)  values_b 
)

product = dot(A,B)

Parameters
[in]inner_index_alist of indices for A.
[in]values_alist of values for A.
[in]inner_index_blist of indices for B.
[in]values_blist of values for B.

◆ pairwisemultiplyvectors()

pure subroutine, public sparsevectormodule::pairwisemultiplyvectors ( integer, dimension(:), intent(in)  inner_index_a,
real(ntreal), dimension(:), intent(in)  values_a,
integer, dimension(:), intent(in)  inner_index_b,
real(ntreal), dimension(:), intent(in)  values_b,
integer, dimension(:), intent(out)  inner_index_c,
real(ntreal), dimension(:), intent(out)  values_c,
integer, intent(out)  total_values_c 
)

Pairwise Multiply Vectors C = A Mult B.

Parameters
[in]inner_index_alist of indices for A.
[in]values_alist of values for A.
[in]inner_index_blist of indices for B.
[in]values_blist of values for B.
[out]inner_index_clist of indices computed for C.
[out]values_clist of values computed for C.
[out]total_values_cthis is the total number of values in C.