00001
00002
00003
00004
00005
00006
00007
00008 #pragma once
00009
00010 #include <cuComplex.h>
00011 #include "defines.h"
00012
00013 #ifdef __cplusplus
00014 #define IS_BASEONE =false
00015 #else
00016 #define IS_BASEONE
00017 #endif
00018
00019 namespace af {
00020
00021 typedef enum {
00022 SUM_T = 0,
00023 PROD_T ,
00024 } af_op_t;
00025
00026 class array;
00027
00036 AFAPI array sum(const array& input, int dim=-1);
00037
00051 template<typename ty> ty sum(const array &input);
00052
00059 AFAPI array prod(const array& input, int dim=-1);
00060
00074 template<typename ty> ty prod(const array &input);
00075
00077
00078
00079
00080
00081
00090 AFAPI array min(const array& input, int dim=-1);
00091
00099 AFAPI void min(array& values, array& indices, const array& input, int dim=-1);
00100
00114 template<typename ty> ty min(const array &input);
00115
00132 template<typename ty> void min(ty *value, int *index, const array& input);
00133
00140 AFAPI array max(const array& input, int dim=-1);
00141
00149 AFAPI void max(array& values, array& indices, const array& input, int dim=-1);
00150
00164 template<typename ty> ty max(const array &input);
00165
00166
00173 template<typename ty> void max(ty *value, int *index, const array& input);
00174
00175
00176
00183 AFAPI array minmax_packed(const array& input, int dim=-1);
00184
00192 AFAPI void minmax(array& minvalues, array& maxvalues, const array& input, int dim=-1);
00193
00207 template<typename ty> ty minmax(const array &input);
00208
00209
00211
00212
00213
00214
00215
00224 AFAPI array alltrue(const array& input, int dim=-1);
00225
00244 template<typename ty> ty alltrue(const array& input);
00245
00252 AFAPI array allfalse(const array& input, int dim=-1);
00253
00259 template<typename ty> ty allfalse(const array& input);
00260
00262
00270 AFAPI array where(const array& input);
00271
00278 AFAPI void where(array& row, array& column, const array& input);
00279
00285 AFAPI unsigned count(const array& input);
00286
00288
00289
00290
00291
00293
00300 AFAPI array segsum(const array& input, const array& keys);
00301
00310 AFAPI array accum(const array& input, int dim=-1, af_op_t op = SUM_T, bool isupcast=false);
00311
00313
00314
00315
00318
00324 AFAPI array setunique(const array& input);
00325
00333 AFAPI void setunique(array& values, array& indices, array& locations, const array& input);
00334
00335
00342 AFAPI array setunion(const array& A, const array& B);
00343
00352 AFAPI void setunion(array& U, array& IA, array& IB, const array& A, const array& B);
00353
00360 AFAPI array setintersect(const array& A, const array& B);
00361
00370 AFAPI void setintersect(array& U, array& IA, array& IB, const array& A, const array& B);
00371
00373
00374
00376
00383 AFAPI array avg(const array& input, int dim=-1);
00384
00390 template<typename ty> ty avg(const array &input);
00391
00398 AFAPI array var(const array& input, bool isbiased=false, int dim=-1);
00399
00407 AFAPI array var(const array& input, const array weights, int dim=-1);
00408
00414 template<typename ty> ty var(const array &input, bool isbiased=false);
00415
00421 template<typename ty> ty var(const array &input, const array weights);
00422
00429 AFAPI array cov(const array& input, bool isbiased=false);
00430
00437 AFAPI array cov(const array& X, const array& Y, bool isbiased=false);
00438
00446 AFAPI array std(const array& in, bool isbiased=false, int dim=-1);
00447
00454 template<typename ty> ty std(const array& input, bool isbiased=false);
00455
00462 AFAPI array median(const array& input, int dim=-1);
00463
00469 template<typename ty> ty median(const array &input);
00470
00471
00473 template<typename ty> ty corrcoef(const array &x, const array &y);
00474
00476 }
00477
00478
00479 #ifdef __cplusplus
00480 extern "C" {
00481 #endif
00482
00492
00493 AFAPI afError af_alltrue_vector_S(bool* h_dst,
00494 unsigned numel, const float *d_src);
00496 AFAPI afError af_alltrue_vector_B(bool* h_dst,
00497 unsigned numel, const bool *d_src);
00499 AFAPI afError af_alltrue_vector_I(bool* h_dst,
00500 unsigned numel, const int *d_src);
00502 AFAPI afError af_alltrue_vector_U(bool* h_dst,
00503 unsigned numel, const unsigned *d_src);
00505 AFAPI afError af_alltrue_vector_C(bool* h_dst,
00506 unsigned numel,
00507 const cuComplex *d_src);
00509 AFAPI afError af_alltrue_vector_D(bool* h_dst,
00510 unsigned numel, const double *d_src);
00512 AFAPI afError af_alltrue_vector_Z(bool* h_dst,
00513 unsigned numel,
00514 const cuDoubleComplex *d_src);
00516
00525
00526 AFAPI afError af_alltrue_S(bool *d_dst,
00527 unsigned ndims, const unsigned* dims,
00528 const float *d_src, int dim);
00530 AFAPI afError af_alltrue_B(bool *d_dst,
00531 unsigned ndims, const unsigned* dims,
00532 const bool *d_src, int dim);
00534 AFAPI afError af_alltrue_I(bool *d_dst,
00535 unsigned ndims, const unsigned* dims,
00536 const int *d_src, int dim);
00538 AFAPI afError af_alltrue_U(bool *d_dst,
00539 unsigned ndims, const unsigned* dims,
00540 const unsigned *d_src, int dim);
00542 AFAPI afError af_alltrue_C(bool *d_dst,
00543 unsigned ndims, const unsigned* dims,
00544 const cuComplex *d_src, int dim);
00546 AFAPI afError af_alltrue_D(bool *d_dst,
00547 unsigned ndims, const unsigned* dims,
00548 const double *d_src, int dim);
00550 AFAPI afError af_alltrue_Z(bool *d_dst,
00551 unsigned ndims, const unsigned* dims,
00552 const cuDoubleComplex *d_src, int dim);
00555
00566
00567 AFAPI afError af_anytrue_vector_S(bool* h_dst,
00568 unsigned numel, const float *d_src);
00570 AFAPI afError af_anytrue_vector_B(bool* h_dst,
00571 unsigned numel, const bool *d_src);
00573 AFAPI afError af_anytrue_vector_I(bool* h_dst,
00574 unsigned numel, const int *d_src);
00576 AFAPI afError af_anytrue_vector_U(bool* h_dst,
00577 unsigned numel, const unsigned *d_src);
00579 AFAPI afError af_anytrue_vector_C(bool* h_dst,
00580 unsigned numel,
00581 const cuComplex *d_src);
00583 AFAPI afError af_anytrue_vector_D(bool* h_dst,
00584 unsigned numel, const double *d_src);
00586 AFAPI afError af_anytrue_vector_Z(bool* h_dst,
00587 unsigned numel,
00588 const cuDoubleComplex *d_src);
00590
00599
00600 AFAPI afError af_anytrue_S(bool *d_dst,
00601 unsigned ndims, const unsigned* dims,
00602 const float *d_src, int dim);
00604 AFAPI afError af_anytrue_B(bool *d_dst,
00605 unsigned ndims, const unsigned* dims,
00606 const bool *d_src, int dim);
00608 AFAPI afError af_anytrue_I(bool *d_dst,
00609 unsigned ndims, const unsigned* dims,
00610 const int *d_src, int dim);
00612 AFAPI afError af_anytrue_U(bool *d_dst,
00613 unsigned ndims, const unsigned* dims,
00614 const unsigned *d_src, int dim);
00616 AFAPI afError af_anytrue_C(bool *d_dst,
00617 unsigned ndims, const unsigned* dims,
00618 const cuComplex *d_src, int dim);
00620 AFAPI afError af_anytrue_D(bool *d_dst,
00621 unsigned ndims, const unsigned* dims,
00622 const double *d_src, int dim);
00624 AFAPI afError af_anytrue_Z(bool *d_dst,
00625 unsigned ndims, const unsigned* dims,
00626 const cuDoubleComplex *d_src, int dim);
00629
00641
00642 AFAPI afError af_max_vector_S(float* h_dst,
00643 unsigned numel, const float *d_src);
00645 AFAPI afError af_max_vector_B(bool* h_dst,
00646 unsigned numel, const bool *d_src);
00648 AFAPI afError af_max_vector_I(int* h_dst,
00649 unsigned numel, const int *d_src);
00651 AFAPI afError af_max_vector_U(unsigned *h_dst,
00652 unsigned numel, const unsigned *d_src);
00654 AFAPI afError af_max_vector_C(cuComplex* h_dst,
00655 unsigned numel,
00656 const cuComplex *d_src);
00658 AFAPI afError af_max_vector_D(double* h_dst,
00659 unsigned numel, const double *d_src);
00661 AFAPI afError af_max_vector_Z(cuDoubleComplex* h_dst,
00662 unsigned numel,
00663 const cuDoubleComplex *d_src);
00665 AFAPI afError af_imax_vector_S(float* h_dst, float* h_idx,
00666 unsigned numel, const float *d_src,
00667 bool is_baseone IS_BASEONE);
00669 AFAPI afError af_imax_vector_I(int* h_dst, float* h_idx,
00670 unsigned numel, const int *d_src,
00671 bool is_baseone IS_BASEONE);
00673 AFAPI afError af_imax_vector_U(unsigned* h_dst, float* h_idx,
00674 unsigned numel, const unsigned *d_src,
00675 bool is_baseone IS_BASEONE);
00677 AFAPI afError af_imax_vector_B(bool* h_dst, float* h_idx,
00678 unsigned numel, const bool *d_src,
00679 bool is_baseone IS_BASEONE);
00681 AFAPI afError af_imax_vector_C(cuComplex* h_dst, float* h_idx,
00682 unsigned numel,
00683 const cuComplex *d_src,
00684 bool is_baseone IS_BASEONE);
00686 AFAPI afError af_imax_vector_D(double* h_dst, float* h_idx,
00687 unsigned numel, const double *d_src,
00688 bool is_baseone IS_BASEONE);
00690 AFAPI afError af_imax_vector_Z(cuDoubleComplex* h_dst, float* h_idx,
00691 unsigned numel,
00692 const cuDoubleComplex *d_src,
00693 bool is_baseone IS_BASEONE);
00695
00706
00707 AFAPI afError af_max_S(float *d_dst,
00708 unsigned ndims, const unsigned* dims,
00709 const float *d_src, int dim);
00711 AFAPI afError af_max_B(bool *d_dst,
00712 unsigned ndims, const unsigned* dims,
00713 const bool *d_src, int dim);
00715 AFAPI afError af_max_I(int *d_dst,
00716 unsigned ndims, const unsigned* dims,
00717 const int *d_src, int dim);
00719 AFAPI afError af_max_U(unsigned *d_dst,
00720 unsigned ndims, const unsigned* dims,
00721 const unsigned *d_src, int dim);
00723 AFAPI afError af_max_C(cuComplex *d_dst,
00724 unsigned ndims, const unsigned* dims,
00725 const cuComplex *d_src, int dim);
00727 AFAPI afError af_max_D(double *d_dst,
00728 unsigned ndims, const unsigned* dims,
00729 const double *d_src, int dim);
00731 AFAPI afError af_max_Z(cuDoubleComplex *d_dst,
00732 unsigned ndims, const unsigned* dims,
00733 const cuDoubleComplex *d_src, int dim);
00735 AFAPI afError af_imax_S(float *d_dst, float *d_idx,
00736 unsigned ndims, const unsigned* dims,
00737 const float *d_src, int dim,
00738 bool is_baseone IS_BASEONE);
00740 AFAPI afError af_imax_I(int *d_dst, float *d_idx,
00741 unsigned ndims, const unsigned* dims,
00742 const int *d_src, int dim,
00743 bool is_baseone IS_BASEONE);
00745 AFAPI afError af_imax_U(unsigned *d_dst, float *d_idx,
00746 unsigned ndims, const unsigned* dims,
00747 const unsigned *d_src, int dim,
00748 bool is_baseone IS_BASEONE);
00750 AFAPI afError af_imax_B(bool *d_dst, float *d_idx,
00751 unsigned ndims, const unsigned* dims,
00752 const bool *d_src, int dim,
00753 bool is_baseone IS_BASEONE);
00755 AFAPI afError af_imax_C(cuComplex *d_dst, float *d_idx,
00756 unsigned ndims, const unsigned* dims,
00757 const cuComplex *d_src, int dim,
00758 bool is_baseone IS_BASEONE);
00760 AFAPI afError af_imax_D(double *d_dst, float *d_idx,
00761 unsigned ndims, const unsigned* dims,
00762 const double *d_src, int dim,
00763 bool is_baseone IS_BASEONE);
00765 AFAPI afError af_imax_Z(cuDoubleComplex *d_dst, float *d_idx,
00766 unsigned ndims, const unsigned* dims,
00767 const cuDoubleComplex *d_src, int dim,
00768 bool is_baseone IS_BASEONE);
00771
00783
00784 AFAPI afError af_min_vector_S(float* h_dst,
00785 unsigned numel, const float *d_src);
00787 AFAPI afError af_min_vector_B(bool* h_dst,
00788 unsigned numel, const bool *d_src);
00790 AFAPI afError af_min_vector_I(int* h_dst,
00791 unsigned numel, const int *d_src);
00793 AFAPI afError af_min_vector_U(unsigned* h_dst,
00794 unsigned numel, const unsigned *d_src);
00796 AFAPI afError af_min_vector_C(cuComplex* h_dst,
00797 unsigned numel,
00798 const cuComplex *d_src);
00800 AFAPI afError af_min_vector_D(double* h_dst,
00801 unsigned numel, const double *d_src);
00803 AFAPI afError af_min_vector_Z(cuDoubleComplex* h_dst,
00804 unsigned numel,
00805 const cuDoubleComplex *d_src);
00807 AFAPI afError af_imin_vector_S(float* h_dst, float* h_idx,
00808 unsigned numel, const float *d_src,
00809 bool is_baseone IS_BASEONE);
00811 AFAPI afError af_imin_vector_I(int* h_dst, float* h_idx,
00812 unsigned numel, const int *d_src,
00813 bool is_baseone IS_BASEONE);
00815 AFAPI afError af_imin_vector_U(unsigned* h_dst, float* h_idx,
00816 unsigned numel, const unsigned *d_src,
00817 bool is_baseone IS_BASEONE);
00819 AFAPI afError af_imin_vector_B(bool* h_dst, float* h_idx,
00820 unsigned numel, const bool *d_src,
00821 bool is_baseone IS_BASEONE);
00823 AFAPI afError af_imin_vector_C(cuComplex* h_dst, float* h_idx,
00824 unsigned numel,
00825 const cuComplex *d_src,
00826 bool is_baseone IS_BASEONE);
00828 AFAPI afError af_imin_vector_D(double* h_dst, float* h_idx,
00829 unsigned numel, const double *d_src,
00830 bool is_baseone IS_BASEONE);
00832 AFAPI afError af_imin_vector_Z(cuDoubleComplex* h_dst, float* h_idx,
00833 unsigned numel,
00834 const cuDoubleComplex *d_src,
00835 bool is_baseone IS_BASEONE);
00837
00848
00849 AFAPI afError af_min_S(float *d_dst,
00850 unsigned ndims, const unsigned* dims,
00851 const float *d_src, int dim);
00853 AFAPI afError af_min_B(bool *d_dst,
00854 unsigned ndims, const unsigned* dims,
00855 const bool *d_src, int dim);
00857 AFAPI afError af_min_I(int *d_dst,
00858 unsigned ndims, const unsigned* dims,
00859 const int *d_src, int dim);
00861 AFAPI afError af_min_U(unsigned *d_dst,
00862 unsigned ndims, const unsigned* dims,
00863 const unsigned *d_src, int dim);
00865 AFAPI afError af_min_C(cuComplex *d_dst,
00866 unsigned ndims, const unsigned* dims,
00867 const cuComplex *d_src, int dim);
00869 AFAPI afError af_min_D(double *d_dst,
00870 unsigned ndims, const unsigned* dims,
00871 const double *d_src, int dim);
00873 AFAPI afError af_min_Z(cuDoubleComplex *d_dst,
00874 unsigned ndims, const unsigned* dims,
00875 const cuDoubleComplex *d_src, int dim);
00877 AFAPI afError af_imin_S(float *d_dst, float *d_idx,
00878 unsigned ndims, const unsigned* dims,
00879 const float *d_src, int dim,
00880 bool is_baseone IS_BASEONE);
00882 AFAPI afError af_imin_I(int *d_dst, float *d_idx,
00883 unsigned ndims, const unsigned* dims,
00884 const int *d_src, int dim,
00885 bool is_baseone IS_BASEONE);
00887 AFAPI afError af_imin_U(unsigned *d_dst, float *d_idx,
00888 unsigned ndims, const unsigned* dims,
00889 const unsigned *d_src, int dim,
00890 bool is_baseone IS_BASEONE);
00892 AFAPI afError af_imin_B(bool *d_dst, float *d_idx,
00893 unsigned ndims, const unsigned* dims,
00894 const bool *d_src, int dim,
00895 bool is_baseone IS_BASEONE);
00897 AFAPI afError af_imin_C(cuComplex *d_dst, float *d_idx,
00898 unsigned ndims, const unsigned* dims,
00899 const cuComplex *d_src, int dim,
00900 bool is_baseone IS_BASEONE);
00902 AFAPI afError af_imin_D(double *d_dst, float *d_idx,
00903 unsigned ndims, const unsigned* dims,
00904 const double *d_src, int dim,
00905 bool is_baseone IS_BASEONE);
00907 AFAPI afError af_imin_Z(cuDoubleComplex *d_dst, float *d_idx,
00908 unsigned ndims, const unsigned* dims,
00909 const cuDoubleComplex *d_src, int dim,
00910 bool is_baseone IS_BASEONE);
00913
00914
00915
00926
00927 AFAPI afError af_minmax_vector_S(float2* h_dst,
00928 unsigned numel, const float *d_src);
00930 AFAPI afError af_minmax_vector_D(double2* h_dst,
00931 unsigned numel, const double *d_src);
00932
00941
00942 AFAPI afError af_minmax_S(float2 *d_dst,
00943 unsigned ndims, const unsigned* dims,
00944 const float *d_src, int dim);
00946 AFAPI afError af_minmax_D(double2 *d_dst,
00947 unsigned ndims, const unsigned* dims,
00948 const double *d_src, int dim);
00951
00952
00963
00964 AFAPI afError af_sum_vector_S(float* h_dst,
00965 unsigned numel, const float *d_src);
00967 AFAPI afError af_sum_vector_B(float* h_dst,
00968 unsigned numel, const bool *d_src);
00970 AFAPI afError af_sum_vector_I(int* h_dst,
00971 unsigned numel, const int *d_src);
00973 AFAPI afError af_sum_vector_U(unsigned* h_dst,
00974 unsigned numel, const unsigned *d_src);
00976 AFAPI afError af_sum_vector_C(cuComplex* h_dst,
00977 unsigned numel,
00978 const cuComplex *d_src);
00980 AFAPI afError af_sum_vector_D(double* h_dst,
00981 unsigned numel, const double *d_src);
00983 AFAPI afError af_sum_vector_Z(cuDoubleComplex* h_dst,
00984 unsigned numel,
00985 const cuDoubleComplex *d_src);
00987
00995
00996 AFAPI afError af_sum_S(float *d_dst,
00997 unsigned ndims, const unsigned* dims,
00998 const float *d_src, int dim);
01000 AFAPI afError af_sum_B(float *d_dst,
01001 unsigned ndims, const unsigned* dims,
01002 const bool *d_src, int dim);
01004 AFAPI afError af_sum_I(int *d_dst,
01005 unsigned ndims, const unsigned* dims,
01006 const int *d_src, int dim);
01008 AFAPI afError af_sum_U(unsigned *d_dst,
01009 unsigned ndims, const unsigned* dims,
01010 const unsigned *d_src, int dim);
01012 AFAPI afError af_sum_C(cuComplex *d_dst,
01013 unsigned ndims, const unsigned* dims,
01014 const cuComplex *d_src, int dim);
01016 AFAPI afError af_sum_D(double *d_dst,
01017 unsigned ndims, const unsigned* dims,
01018 const double *d_src, int dim);
01020 AFAPI afError af_sum_Z(cuDoubleComplex *d_dst,
01021 unsigned ndims, const unsigned* dims,
01022 const cuDoubleComplex *d_src, int dim);
01025
01036
01037 AFAPI afError af_prod_vector_S(float* h_dst,
01038 unsigned numel, const float *d_src);
01040 AFAPI afError af_prod_vector_I(int* h_dst,
01041 unsigned numel, const int *d_src);
01043 AFAPI afError af_prod_vector_U(unsigned* h_dst,
01044 unsigned numel, const unsigned *d_src);
01046 AFAPI afError af_prod_vector_B(float* h_dst,
01047 unsigned numel, const bool *d_src);
01049 AFAPI afError af_prod_vector_C(cuComplex* h_dst,
01050 unsigned numel,
01051 const cuComplex *d_src);
01053 AFAPI afError af_prod_vector_D(double* h_dst,
01054 unsigned numel, const double *d_src);
01056 AFAPI afError af_prod_vector_Z(cuDoubleComplex* h_dst,
01057 unsigned numel,
01058 const cuDoubleComplex *d_src);
01060
01068
01069 AFAPI afError af_prod_S(float *d_dst,
01070 unsigned ndims, const unsigned* dims,
01071 const float *d_src, int dim);
01073 AFAPI afError af_prod_I(int *d_dst,
01074 unsigned ndims, const unsigned* dims,
01075 const int *d_src, int dim);
01077 AFAPI afError af_prod_U(unsigned *d_dst,
01078 unsigned ndims, const unsigned* dims,
01079 const unsigned *d_src, int dim);
01081 AFAPI afError af_prod_B(float *d_dst,
01082 unsigned ndims, const unsigned* dims,
01083 const bool *d_src, int dim);
01085 AFAPI afError af_prod_C(cuComplex *d_dst,
01086 unsigned ndims, const unsigned* dims,
01087 const cuComplex *d_src, int dim);
01089 AFAPI afError af_prod_D(double *d_dst,
01090 unsigned ndims, const unsigned* dims,
01091 const double *d_src,
01092 int dim);
01094 AFAPI afError af_prod_Z(cuDoubleComplex *d_dst,
01095 unsigned ndims, const unsigned* dims,
01096 const cuDoubleComplex *d_src, int dim);
01099
01112
01113 AFAPI afError af_nnz_S(unsigned* count,
01114 unsigned numel, const float* mat,
01115 unsigned batch);
01117 AFAPI afError af_nnz_B(unsigned* count,
01118 unsigned numel, const bool* mat,
01119 unsigned batch);
01121 AFAPI afError af_nnz_D(unsigned* count,
01122 unsigned numel, const double* mat,
01123 unsigned batch);
01126
01138
01139 AFAPI afError af_nnz_vector_S(unsigned* count,
01140 unsigned numel, const float* mat);
01142 AFAPI afError af_nnz_vector_B(unsigned* count,
01143 unsigned numel, const bool* mat);
01145 AFAPI afError af_nnz_vector_D(unsigned* count,
01146 unsigned numel, const double* mat);
01149
01151 AFAPI afError all_stride_r(unsigned nout, unsigned numel,
01152 unsigned stride, unsigned batch,
01153 unsigned outer_stride, unsigned outer_batch,
01154 void *d_dst, unsigned cls_dst,
01155 const void *d_src, unsigned cls_src,
01156 float *d_idx, bool cplx,
01157 bool idx_out, bool device_result);
01158 AFAPI afError any_stride_r(unsigned nout, unsigned numel,
01159 unsigned stride, unsigned batch,
01160 unsigned outer_stride, unsigned outer_batch,
01161 void *d_dst, unsigned cls_dst,
01162 const void *d_src, unsigned cls_src,
01163 float *d_idx, bool cplx,
01164 bool idx_out, bool device_result);
01165 AFAPI afError min_stride_r(unsigned nout, unsigned numel,
01166 unsigned stride, unsigned batch,
01167 unsigned outer_stride, unsigned outer_batch,
01168 void *d_dst, unsigned cls_dst,
01169 const void *d_src, unsigned cls_src,
01170 float *d_idx, bool cplx,
01171 bool idx_out, bool device_result);
01172 AFAPI afError max_stride_r(unsigned nout, unsigned numel,
01173 unsigned stride, unsigned batch,
01174 unsigned outer_stride, unsigned outer_batch,
01175 void *d_dst, unsigned cls_dst,
01176 const void *d_src, unsigned cls_src,
01177 float *d_idx, bool cplx,
01178 bool idx_out, bool device_result);
01179 AFAPI afError sum_stride_r(unsigned nout, unsigned numel,
01180 unsigned stride, unsigned batch,
01181 unsigned outer_stride, unsigned outer_batch,
01182 void *d_dst, unsigned cls_dst,
01183 const void *d_src, unsigned cls_src,
01184 float *d_idx, bool cplx,
01185 bool idx_out, bool device_result);
01186
01187 #ifdef __cplusplus
01188 }
01189 #endif
01190
01191 #ifdef __cplusplus
01192
01193 AFAPI afError af_alltrue_vector(bool* h_dst,
01194 unsigned numel, const float *d_src);
01196 AFAPI afError af_alltrue_vector(bool* h_dst,
01197 unsigned numel, const bool *d_src);
01199 AFAPI afError af_alltrue_vector(bool* h_dst,
01200 unsigned numel, const int *d_src);
01202 AFAPI afError af_alltrue_vector(bool* h_dst,
01203 unsigned numel, const unsigned *d_src);
01205 AFAPI afError af_alltrue_vector(bool* h_dst,
01206 unsigned numel,
01207 const cuComplex *d_src);
01209 AFAPI afError af_alltrue_vector(bool* h_dst,
01210 unsigned numel, const double *d_src);
01212 AFAPI afError af_alltrue_vector(bool* h_dst,
01213 unsigned numel,
01214 const cuDoubleComplex *d_src);
01215
01217 AFAPI afError af_alltrue(bool *d_dst,
01218 unsigned ndims, const unsigned* dims,
01219 const float *d_src, int dim);
01221 AFAPI afError af_alltrue(bool *d_dst,
01222 unsigned ndims, const unsigned* dims,
01223 const bool *d_src, int dim);
01225 AFAPI afError af_alltrue(bool *d_dst,
01226 unsigned ndims, const unsigned* dims,
01227 const int *d_src, int dim);
01229 AFAPI afError af_alltrue(bool *d_dst,
01230 unsigned ndims, const unsigned* dims,
01231 const unsigned *d_src, int dim);
01233 AFAPI afError af_alltrue(bool *d_dst,
01234 unsigned ndims, const unsigned* dims,
01235 const cuComplex *d_src, int dim);
01237 AFAPI afError af_alltrue(bool *d_dst,
01238 unsigned ndims, const unsigned* dims,
01239 const double *d_src, int dim);
01241 AFAPI afError af_alltrue(bool *d_dst,
01242 unsigned ndims, const unsigned* dims,
01243 const cuDoubleComplex *d_src, int dim);
01244
01246 AFAPI afError af_anytrue_vector(bool* h_dst,
01247 unsigned numel, const float *d_src);
01249 AFAPI afError af_anytrue_vector(bool* h_dst,
01250 unsigned numel, const bool *d_src);
01252 AFAPI afError af_anytrue_vector(bool* h_dst,
01253 unsigned numel, const int *d_src);
01255 AFAPI afError af_anytrue_vector(bool* h_dst,
01256 unsigned numel, const unsigned *d_src);
01258 AFAPI afError af_anytrue_vector(bool* h_dst,
01259 unsigned numel,
01260 const cuComplex *d_src);
01262 AFAPI afError af_anytrue_vector(bool* h_dst,
01263 unsigned numel, const double *d_src);
01265 AFAPI afError af_anytrue_vector(bool* h_dst,
01266 unsigned numel,
01267 const cuDoubleComplex *d_src);
01268
01270 AFAPI afError af_anytrue(bool *d_dst,
01271 unsigned ndims, const unsigned* dims,
01272 const float *d_src, int dim);
01274 AFAPI afError af_anytrue(bool *d_dst,
01275 unsigned ndims, const unsigned* dims,
01276 const bool *d_src, int dim);
01278 AFAPI afError af_anytrue(bool *d_dst,
01279 unsigned ndims, const unsigned* dims,
01280 const int *d_src, int dim);
01282 AFAPI afError af_anytrue(bool *d_dst,
01283 unsigned ndims, const unsigned* dims,
01284 const unsigned *d_src, int dim);
01286 AFAPI afError af_anytrue(bool *d_dst,
01287 unsigned ndims, const unsigned* dims,
01288 const cuComplex *d_src, int dim);
01290 AFAPI afError af_anytrue(bool *d_dst,
01291 unsigned ndims, const unsigned* dims,
01292 const double *d_src, int dim);
01294 AFAPI afError af_anytrue(bool *d_dst,
01295 unsigned ndims, const unsigned* dims,
01296 const cuDoubleComplex *d_src, int dim);
01297
01298
01300 AFAPI afError af_max_vector(float* h_dst,
01301 unsigned numel, const float *d_src);
01303 AFAPI afError af_max_vector(bool* h_dst,
01304 unsigned numel, const bool *d_src);
01306 AFAPI afError af_max_vector(int* h_dst,
01307 unsigned numel, const int *d_src);
01309 AFAPI afError af_max_vector(unsigned* h_dst,
01310 unsigned numel, const unsigned *d_src);
01312 AFAPI afError af_max_vector(cuComplex* h_dst,
01313 unsigned numel,
01314 const cuComplex *d_src);
01316 AFAPI afError af_max_vector(double* h_dst,
01317 unsigned numel, const double *d_src);
01319 AFAPI afError af_max_vector(cuDoubleComplex* h_dst,
01320 unsigned numel,
01321 const cuDoubleComplex *d_src);
01322
01324 AFAPI afError af_imax_vector(float* h_dst, float* h_idx,
01325 unsigned numel, const float *d_src,
01326 bool is_baseone IS_BASEONE);
01328 AFAPI afError af_imax_vector(int* h_dst, float* h_idx,
01329 unsigned numel, const int *d_src,
01330 bool is_baseone IS_BASEONE);
01332 AFAPI afError af_imax_vector(unsigned* h_dst, float* h_idx,
01333 unsigned numel, const unsigned *d_src,
01334 bool is_baseone IS_BASEONE);
01336 AFAPI afError af_imax_vector(bool* h_dst, float* h_idx,
01337 unsigned numel, const bool *d_src,
01338 bool is_baseone IS_BASEONE);
01340 AFAPI afError af_imax_vector(cuComplex* h_dst, float* h_idx,
01341 unsigned numel,
01342 const cuComplex *d_src,
01343 bool is_baseone IS_BASEONE);
01345 AFAPI afError af_imax_vector(double* h_dst, float* h_idx,
01346 unsigned numel, const double *d_src,
01347 bool is_baseone IS_BASEONE);
01349 AFAPI afError af_imax_vector(cuDoubleComplex* h_dst, float* h_idx,
01350 unsigned numel,
01351 const cuDoubleComplex *d_src,
01352 bool is_baseone IS_BASEONE);
01353
01355 AFAPI afError af_max(float *d_dst,
01356 unsigned ndims, const unsigned* dims,
01357 const float *d_src, int dim);
01359 AFAPI afError af_max(bool *d_dst,
01360 unsigned ndims, const unsigned* dims,
01361 const bool *d_src, int dim);
01363 AFAPI afError af_max(int *d_dst,
01364 unsigned ndims, const unsigned* dims,
01365 const int *d_src, int dim);
01367 AFAPI afError af_max(unsigned *d_dst,
01368 unsigned ndims, const unsigned* dims,
01369 const unsigned *d_src, int dim);
01371 AFAPI afError af_max(cuComplex *d_dst,
01372 unsigned ndims, const unsigned* dims,
01373 const cuComplex *d_src, int dim);
01375 AFAPI afError af_max(double *d_dst,
01376 unsigned ndims, const unsigned* dims,
01377 const double *d_src, int dim);
01379 AFAPI afError af_max(cuDoubleComplex *d_dst,
01380 unsigned ndims, const unsigned* dims,
01381 const cuDoubleComplex *d_src, int dim);
01382
01384 AFAPI afError af_imax(float *d_dst, float *d_idx,
01385 unsigned ndims, const unsigned* dims,
01386 const float *d_src, int dim,
01387 bool is_baseone IS_BASEONE);
01389 AFAPI afError af_imax(int *d_dst, float *d_idx,
01390 unsigned ndims, const unsigned* dims,
01391 const int *d_src, int dim,
01392 bool is_baseone IS_BASEONE);
01394 AFAPI afError af_imax(unsigned *d_dst, float *d_idx,
01395 unsigned ndims, const unsigned* dims,
01396 const unsigned *d_src, int dim,
01397 bool is_baseone IS_BASEONE);
01399 AFAPI afError af_imax(bool *d_dst, float *d_idx,
01400 unsigned ndims, const unsigned* dims,
01401 const bool *d_src, int dim,
01402 bool is_baseone IS_BASEONE);
01404 AFAPI afError af_imax(cuComplex *d_dst, float *d_idx,
01405 unsigned ndims, const unsigned* dims,
01406 const cuComplex *d_src, int dim,
01407 bool is_baseone IS_BASEONE);
01409 AFAPI afError af_imax(double *d_dst, float *d_idx,
01410 unsigned ndims, const unsigned* dims,
01411 const double *d_src, int dim,
01412 bool is_baseone IS_BASEONE);
01414 AFAPI afError af_imax(cuDoubleComplex *d_dst, float *d_idx,
01415 unsigned ndims, const unsigned* dims,
01416 const cuDoubleComplex *d_src, int dim,
01417 bool is_baseone IS_BASEONE);
01418
01420 AFAPI afError af_min_vector(float* h_dst,
01421 unsigned numel, const float *d_src);
01423 AFAPI afError af_min_vector(bool* h_dst,
01424 unsigned numel, const bool *d_src);
01426 AFAPI afError af_min_vector(int* h_dst,
01427 unsigned numel, const int *d_src);
01429 AFAPI afError af_min_vector(unsigned* h_dst,
01430 unsigned numel, const unsigned *d_src);
01432 AFAPI afError af_min_vector(cuComplex* h_dst,
01433 unsigned numel,
01434 const cuComplex *d_src);
01436 AFAPI afError af_min_vector(double* h_dst,
01437 unsigned numel, const double *d_src);
01439 AFAPI afError af_min_vector(cuDoubleComplex* h_dst,
01440 unsigned numel,
01441 const cuDoubleComplex *d_src);
01442
01444 AFAPI afError af_imin_vector(float* h_dst, float* h_idx,
01445 unsigned numel, const float *d_src,
01446 bool is_baseone IS_BASEONE);
01448 AFAPI afError af_imin_vector(int* h_dst, float* h_idx,
01449 unsigned numel, const int *d_src,
01450 bool is_baseone IS_BASEONE);
01452 AFAPI afError af_imin_vector(unsigned* h_dst, float* h_idx,
01453 unsigned numel, const unsigned *d_src,
01454 bool is_baseone IS_BASEONE);
01456 AFAPI afError af_imin_vector(bool* h_dst, float* h_idx,
01457 unsigned numel, const bool *d_src,
01458 bool is_baseone IS_BASEONE);
01460 AFAPI afError af_imin_vector(cuComplex* h_dst, float* h_idx,
01461 unsigned numel,
01462 const cuComplex *d_src,
01463 bool is_baseone IS_BASEONE);
01465 AFAPI afError af_imin_vector(double* h_dst, float* h_idx,
01466 unsigned numel, const double *d_src,
01467 bool is_baseone IS_BASEONE);
01469 AFAPI afError af_imin_vector(cuDoubleComplex* h_dst, float* h_idx,
01470 unsigned numel,
01471 const cuDoubleComplex *d_src,
01472 bool is_baseone IS_BASEONE);
01473
01475 AFAPI afError af_min(float *d_dst,
01476 unsigned ndims, const unsigned* dims,
01477 const float *d_src, int dim);
01479 AFAPI afError af_min(bool *d_dst,
01480 unsigned ndims, const unsigned* dims,
01481 const bool *d_src, int dim);
01483 AFAPI afError af_min(int *d_dst,
01484 unsigned ndims, const unsigned* dims,
01485 const int *d_src, int dim);
01487 AFAPI afError af_min(unsigned *d_dst,
01488 unsigned ndims, const unsigned* dims,
01489 const unsigned *d_src, int dim);
01491 AFAPI afError af_min(cuComplex *d_dst,
01492 unsigned ndims, const unsigned* dims,
01493 const cuComplex *d_src, int dim);
01495 AFAPI afError af_min(cuComplex *d_dst,
01496 unsigned ndims, const unsigned* dims,
01497 const cuComplex *d_src, int dim);
01499 AFAPI afError af_min(double *d_dst,
01500 unsigned ndims, const unsigned* dims,
01501 const double *d_src, int dim);
01503 AFAPI afError af_min(cuDoubleComplex *d_dst,
01504 unsigned ndims, const unsigned* dims,
01505 const cuDoubleComplex *d_src, int dim);
01506
01508 AFAPI afError af_imin(float *d_dst, float *d_idx,
01509 unsigned ndims, const unsigned* dims,
01510 const float *d_src, int dim,
01511 bool is_baseone IS_BASEONE);
01513 AFAPI afError af_imin(int *d_dst, float *d_idx,
01514 unsigned ndims, const unsigned* dims,
01515 const int *d_src, int dim,
01516 bool is_baseone IS_BASEONE);
01518 AFAPI afError af_imin(unsigned *d_dst, float *d_idx,
01519 unsigned ndims, const unsigned* dims,
01520 const unsigned *d_src, int dim,
01521 bool is_baseone IS_BASEONE);
01523 AFAPI afError af_imin(bool *d_dst, float *d_idx,
01524 unsigned ndims, const unsigned* dims,
01525 const bool *d_src, int dim,
01526 bool is_baseone IS_BASEONE);
01528 AFAPI afError af_imin(cuComplex *d_dst, float *d_idx,
01529 unsigned ndims, const unsigned* dims,
01530 const cuComplex *d_src, int dim,
01531 bool is_baseone IS_BASEONE);
01533 AFAPI afError af_imin(double *d_dst, float *d_idx,
01534 unsigned ndims, const unsigned* dims,
01535 const double *d_src, int dim,
01536 bool is_baseone IS_BASEONE);
01538 AFAPI afError af_imin(cuDoubleComplex *d_dst, float *d_idx,
01539 unsigned ndims, const unsigned* dims,
01540 const cuDoubleComplex *d_src, int dim,
01541 bool is_baseone IS_BASEONE);
01542
01543
01544
01546 AFAPI afError af_minmax_vector(float2* h_dst,
01547 unsigned numel, const float *d_src);
01549 AFAPI afError af_minmax(float2 *d_dst,
01550 unsigned ndims, const unsigned* dims,
01551 const float *d_src, int dim);
01553 AFAPI afError af_minmax_vector(double2* h_dst,
01554 unsigned numel, const double *d_src);
01556 AFAPI afError af_minmax(double2 *d_dst,
01557 unsigned ndims, const unsigned* dims,
01558 const double *d_src, int dim);
01559
01560
01562 AFAPI afError af_sum_vector(float* h_dst,
01563 unsigned numel, const float *d_src);
01565 AFAPI afError af_sum_vector(float* h_dst,
01566 unsigned numel, const bool *d_src);
01568 AFAPI afError af_sum_vector(int* h_dst,
01569 unsigned numel, const int *d_src);
01571 AFAPI afError af_sum_vector(unsigned* h_dst,
01572 unsigned numel, const unsigned *d_src);
01574 AFAPI afError af_sum_vector(cuComplex* h_dst,
01575 unsigned numel,
01576 const cuComplex *d_src);
01578 AFAPI afError af_sum_vector(double* h_dst,
01579 unsigned numel, const double *d_src);
01581 AFAPI afError af_sum_vector(cuDoubleComplex* h_dst,
01582 unsigned numel,
01583 const cuDoubleComplex *d_src);
01584
01586 AFAPI afError af_sum(float *d_dst,
01587 unsigned ndims, const unsigned* dims,
01588 const float *d_src, int dim);
01590 AFAPI afError af_sum(float *d_dst,
01591 unsigned ndims, const unsigned* dims,
01592 const bool *d_src, int dim);
01594 AFAPI afError af_sum(int *d_dst,
01595 unsigned ndims, const unsigned* dims,
01596 const int *d_src, int dim);
01598 AFAPI afError af_sum(unsigned *d_dst,
01599 unsigned ndims, const unsigned* dims,
01600 const unsigned *d_src, int dim);
01602 AFAPI afError af_sum(cuComplex *d_dst,
01603 unsigned ndims, const unsigned* dims,
01604 const cuComplex *d_src, int dim);
01606 AFAPI afError af_sum(double *d_dst,
01607 unsigned ndims, const unsigned* dims,
01608 const double *d_src, int dim);
01610 AFAPI afError af_sum(cuDoubleComplex *d_dst,
01611 unsigned ndims, const unsigned* dims,
01612 const cuDoubleComplex *d_src, int dim);
01613
01614
01616 AFAPI afError af_prod_vector(float* h_dst,
01617 unsigned numel, const float *d_src);
01619 AFAPI afError af_prod_vector(int* h_dst,
01620 unsigned numel, const int *d_src);
01622 AFAPI afError af_prod_vector(unsigned* h_dst,
01623 unsigned numel, const unsigned *d_src);
01625 AFAPI afError af_prod_vector(float* h_dst,
01626 unsigned numel, const bool *d_src);
01628 AFAPI afError af_prod_vector(cuComplex* h_dst,
01629 unsigned numel,
01630 const cuComplex *d_src);
01632 AFAPI afError af_prod_vector(double* h_dst,
01633 unsigned numel, const double *d_src);
01635 AFAPI afError af_prod_vector(cuDoubleComplex* h_dst,
01636 unsigned numel,
01637 const cuDoubleComplex *d_src);
01638
01640 AFAPI afError af_prod(float *d_dst,
01641 unsigned ndims, const unsigned* dims,
01642 const float *d_src, int dim);
01644 AFAPI afError af_prod(int *d_dst,
01645 unsigned ndims, const unsigned* dims,
01646 const int *d_src, int dim);
01648 AFAPI afError af_prod(unsigned *d_dst,
01649 unsigned ndims, const unsigned* dims,
01650 const unsigned *d_src, int dim);
01652 AFAPI afError af_prod(float *d_dst,
01653 unsigned ndims, const unsigned* dims,
01654 const bool *d_src, int dim);
01656 AFAPI afError af_prod(cuComplex *d_dst,
01657 unsigned ndims, const unsigned* dims,
01658 const cuComplex *d_src, int dim);
01660 AFAPI afError af_prod(double *d_dst,
01661 unsigned ndims, const unsigned* dims,
01662 const double *d_src,
01663 int dim);
01665 AFAPI afError af_prod(cuDoubleComplex *d_dst,
01666 unsigned ndims, const unsigned* dims,
01667 const cuDoubleComplex *d_src, int dim);
01668
01679 AFAPI afError af_segsum_S(float *d_out,
01680 unsigned numel,
01681 const float *d_in, const float *d_keys,
01682 unsigned batch);
01685
01686
01700
01701 AFAPI afError af_accum_S(float *d_out,
01702 unsigned ndims, unsigned* dims,
01703 const float *d_in, unsigned batch,
01704 int dimension, int type, bool isupcast);
01706 AFAPI afError af_accum_D(double *d_out,
01707 unsigned ndims, unsigned* dims,
01708 const double *d_in, unsigned batch,
01709 int dimension, int type);
01711 AFAPI afError af_accum_I(int *d_out,
01712 unsigned ndims, unsigned* dims,
01713 const int *d_in, unsigned batch,
01714 int dimension, int type);
01716 AFAPI afError af_accum_U(unsigned *d_out,
01717 unsigned ndims, unsigned* dims,
01718 const unsigned *d_in, unsigned batch,
01719 int dimension, int type);
01721 AFAPI afError af_accum_C(cuComplex *d_out,
01722 unsigned ndims, unsigned* dims,
01723 const cuComplex *d_in, unsigned batch,
01724 int dimension, int type, bool isupcast);
01726 AFAPI afError af_accum_Z(cuDoubleComplex *d_out,
01727 unsigned ndims, unsigned* dims,
01728 const cuDoubleComplex *d_in, unsigned batch,
01729 int dimension, int type);
01733
01734
01735
01745
01746 AFAPI afError af_where_BS(unsigned *n_out, float **d_indices, unsigned n_in, const bool *d_X, bool is_baseone IS_BASEONE);
01748 AFAPI afError af_where_BD(unsigned *n_out, double **d_indices, unsigned n_in, const bool *d_X, bool is_baseone IS_BASEONE);
01750 AFAPI afError af_where_BU(unsigned *n_out, unsigned **d_indices, unsigned n_in, const bool *d_X, bool is_baseone IS_BASEONE);
01752 AFAPI afError af_where_SS(unsigned *n_out, float **d_indices, unsigned n_in, const float *d_X, bool is_baseone IS_BASEONE);
01754 AFAPI afError af_where_SD(unsigned *n_out, double **d_indices, unsigned n_in, const float *d_X, bool is_baseone IS_BASEONE);
01756 AFAPI afError af_where_DD(unsigned *n_out, double **d_indices, unsigned n_in, const double *d_X, bool is_baseone IS_BASEONE);
01758 AFAPI afError af_where_UU(unsigned *n_out, unsigned **d_indices, unsigned n_in, const unsigned *d_X, bool is_baseone IS_BASEONE);
01760 AFAPI afError af_where_II(unsigned *n_out, int **d_indices, unsigned n_in, const int *d_X, bool is_baseone IS_BASEONE);
01762
01763
01775
01776 AFAPI afError af_where2_BS(unsigned* n_out, float **d_I, float **d_J, unsigned n_in, unsigned rows, const bool *d_X, bool is_baseone IS_BASEONE);
01778 AFAPI afError af_where2_BD(unsigned* n_out, double **d_I, double **d_J, unsigned n_in, unsigned rows, const bool *d_X, bool is_baseone IS_BASEONE);
01780 AFAPI afError af_where2_SS(unsigned* n_out, float **d_I, float **d_J, unsigned n_in, unsigned rows, const float *d_X, bool is_baseone IS_BASEONE);
01782 AFAPI afError af_where2_SD(unsigned* n_out, double **d_I, double **d_J, unsigned n_in, unsigned rows, const float *d_X, bool is_baseone IS_BASEONE);
01784 AFAPI afError af_where2_DD(unsigned* n_out, double **d_I, double **d_J, unsigned n_in, unsigned rows, const double *d_X, bool is_baseone IS_BASEONE);
01786 AFAPI afError af_where2_UU(unsigned* n_out, unsigned **d_I, unsigned **d_J, unsigned n_in, unsigned rows, const unsigned *d_X, bool is_baseone IS_BASEONE);
01788 AFAPI afError af_where2_II(unsigned* n_out, int **d_I, int **d_J, unsigned n_in, unsigned rows, const int *d_X, bool is_baseone IS_BASEONE);
01790
01792
01793
01794
01803
01804 AFAPI afError af_randu_S(float *d_Y, unsigned numel);
01806 AFAPI afError af_randu_D(double *d_Y, unsigned numel);
01808 inline afError af_randu_C(cuComplex *d_Y, unsigned numel) { return af_randu_S((float*)d_Y, 2 * numel); }
01810 inline afError af_randu_Z(cuDoubleComplex *d_Y, unsigned numel) { return af_randu_D((double*)d_Y, 2 * numel); }
01812 AFAPI afError af_randu_setseed(unsigned long long seed);
01814
01821
01822 AFAPI afError af_randn_S(float *d_Y, unsigned numel);
01824 AFAPI afError af_randn_D(double *d_Y, unsigned numel);
01826 inline afError af_randn_C(cuComplex *d_Y, unsigned numel) { return af_randn_S((float*)d_Y, 2 * numel); }
01828 inline afError af_randn_Z(cuDoubleComplex *d_Y, unsigned numel) { return af_randn_D((double*)d_Y, 2 * numel); }
01830 AFAPI afError af_randn_setseed(unsigned long long seed);
01833
01834
01835 AFAPI afError af_int_S(int *out, float *in, unsigned numel);
01836 AFAPI afError af_int_D(int *out, double *in, unsigned numel);
01837
01838 AFAPI afError af_S_int(float *out, int *in, unsigned numel);
01839 AFAPI afError af_D_int(double *out, int *in, unsigned numel);
01840
01841 #endif // ifdef __cplusplus