core.h (2014-04-30 15:38:09 -0400, (build fd32605))
Go to the documentation of this file.
1 // Copyright (c) AccelerEyes LLC. All rights reserved. //
2 // See http://www.accelereyes.com/eula for details. //
3 // This software is distributed WITHOUT ANY WARRANTY; without even //
4 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
5 // PURPOSE. See the above copyright notices for more information. //
6 //-----------------------------------------------------------------------//
7 
8 #pragma once
9 #include "defines.h"
10 
11 #ifdef __cplusplus
12 #define IS_BASEONE =false
13 #else
14 #define IS_BASEONE
15 #endif
16 
17 namespace af {
18 
19  typedef enum {
20  sum_t = 0,
22  } af_op_t;
23 
24  class array;
363  AFAPI array dot(const array& A, const array &B);
364 
379  AFAPI array sum(const array& input, int dim=-1);
380 
385  template<typename ty> ty sum(const array &input);
386 
406  AFAPI array mul(const array& input, int dim=-1);
407 
412  template<typename ty> ty mul(const array &input);
413 
435  AFAPI array min(const array& input, int dim=-1);
436 
448  AFAPI void min(array& values, array& indices, const array& input, int dim=-1);
449 
456  template<typename ty> ty min(const array &input);
457 
467  template<typename ty> void min(ty *value, int *index, const array& input);
468 
490  AFAPI array max(const array& input, int dim=-1);
491 
503  AFAPI void max(array& values, array& indices, const array& input, int dim=-1);
504 
518  template<typename ty> ty max(const array &input);
519 
520 
530  template<typename ty> void max(ty *value, int *index, const array& input);
531 
553  AFAPI array minmax_packed(const array& input, int dim=-1);
554 
564  AFAPI void minmax(array& minvalues, array& maxvalues, const array& input, int dim=-1);
565 
580  template<typename ty> ty minmax(const array &input);
581 
602  AFAPI array alltrue(const array& input, int dim=-1);
603 
611  template<typename ty> ty alltrue(const array& input);
612 
644  AFAPI array anytrue(const array& input, int dim=-1);
645 
652  template<typename ty> ty anytrue(const array& input);
653 
678  AFAPI array where(const array& input);
679 
694  AFAPI void where(array& row, array& column, const array& input);
695 
721  AFAPI unsigned count(const array& input);
722 
755  AFAPI array segsum(const array& input, const array& segments, bool reduce=false);
756 
786  AFAPI array accum(const array& input, int dim=-1, af_op_t op = sum_t, bool isupcast=false);
787 
815  AFAPI array setunique(const array& input);
816 
841  AFAPI void setunique(array& values, array& indices, array& locations, const array& input);
842 
869  AFAPI array setunion(const array& A, const array& B);
870 
891  AFAPI void setunion(array& U, array& IA, array& IB, const array& A, const array& B);
892 
920  AFAPI array setintersect(const array& A, const array& B);
921 
942  AFAPI void setintersect(array& U, array& IA, array& IB, const array& A, const array& B);
943 
964  AFAPI array mean(const array& input, int dim=-1);
965 
978  template<typename ty> ty mean(const array &input);
979 
999  AFAPI array var(const array& input, bool isbiased=false, int dim=-1);
1000 
1009  AFAPI array var(const array& input, const array weights, int dim=-1);
1010 
1025  template<typename ty> ty var(const array &input, bool isbiased=false);
1026 
1032  template<typename ty> ty var(const array &input, const array weights);
1033 
1053  AFAPI array cov(const array& input, bool isbiased=false);
1054 
1063  AFAPI array cov(const array& X, const array& Y, bool isbiased=false);
1064 
1084  AFAPI array stdev(const array& in, int dim=-1);
1085 
1098  template<typename ty> ty stdev(const array& input);
1099 
1118  AFAPI array median(const array& input, int dim=-1);
1119 
1132  template<typename ty> ty median(const array &input);
1133 
1161  template<typename ty> ty corrcoef(const array &x, const array &y);
1162 
1166 } // namespace af
1167 
1168 
1169 #ifdef __cplusplus
1170 extern "C" {
1171 #endif
1172 
1186  AFAPI afError af_alltrue_vector_S(bool* h_dst,
1188  unsigned numel, const float *d_src);
1190  AFAPI afError af_alltrue_vector_B(bool* h_dst,
1191  unsigned numel, const bool *d_src);
1193  AFAPI afError af_alltrue_vector_I(bool* h_dst,
1194  unsigned numel, const int *d_src);
1196  AFAPI afError af_alltrue_vector_U(bool* h_dst,
1197  unsigned numel, const unsigned *d_src);
1199  AFAPI afError af_alltrue_vector_C(bool* h_dst,
1200  unsigned numel,
1201  const cfloat *d_src);
1203  AFAPI afError af_alltrue_vector_D(bool* h_dst,
1204  unsigned numel, const double *d_src);
1206  AFAPI afError af_alltrue_vector_Z(bool* h_dst,
1207  unsigned numel,
1208  const cdouble *d_src);
1209 
1218  AFAPI afError af_alltrue_S(bool *d_dst,
1220  unsigned ndims, const unsigned* dims,
1221  const float *d_src, int dim);
1223  AFAPI afError af_alltrue_B(bool *d_dst,
1224  unsigned ndims, const unsigned* dims,
1225  const bool *d_src, int dim);
1227  AFAPI afError af_alltrue_I(bool *d_dst,
1228  unsigned ndims, const unsigned* dims,
1229  const int *d_src, int dim);
1231  AFAPI afError af_alltrue_U(bool *d_dst,
1232  unsigned ndims, const unsigned* dims,
1233  const unsigned *d_src, int dim);
1235  AFAPI afError af_alltrue_C(bool *d_dst,
1236  unsigned ndims, const unsigned* dims,
1237  const cfloat *d_src, int dim);
1239  AFAPI afError af_alltrue_D(bool *d_dst,
1240  unsigned ndims, const unsigned* dims,
1241  const double *d_src, int dim);
1243  AFAPI afError af_alltrue_Z(bool *d_dst,
1244  unsigned ndims, const unsigned* dims,
1245  const cdouble *d_src, int dim);
1246 
1265  AFAPI afError af_anytrue_vector_S(bool* h_dst,
1267  unsigned numel, const float *d_src);
1269  AFAPI afError af_anytrue_vector_B(bool* h_dst,
1270  unsigned numel, const bool *d_src);
1272  AFAPI afError af_anytrue_vector_I(bool* h_dst,
1273  unsigned numel, const int *d_src);
1275  AFAPI afError af_anytrue_vector_U(bool* h_dst,
1276  unsigned numel, const unsigned *d_src);
1278  AFAPI afError af_anytrue_vector_C(bool* h_dst,
1279  unsigned numel,
1280  const cfloat *d_src);
1282  AFAPI afError af_anytrue_vector_D(bool* h_dst,
1283  unsigned numel, const double *d_src);
1285  AFAPI afError af_anytrue_vector_Z(bool* h_dst,
1286  unsigned numel,
1287  const cdouble *d_src);
1288 
1297  AFAPI afError af_anytrue_S(bool *d_dst,
1299  unsigned ndims, const unsigned* dims,
1300  const float *d_src, int dim);
1302  AFAPI afError af_anytrue_B(bool *d_dst,
1303  unsigned ndims, const unsigned* dims,
1304  const bool *d_src, int dim);
1306  AFAPI afError af_anytrue_I(bool *d_dst,
1307  unsigned ndims, const unsigned* dims,
1308  const int *d_src, int dim);
1310  AFAPI afError af_anytrue_U(bool *d_dst,
1311  unsigned ndims, const unsigned* dims,
1312  const unsigned *d_src, int dim);
1314  AFAPI afError af_anytrue_C(bool *d_dst,
1315  unsigned ndims, const unsigned* dims,
1316  const cfloat *d_src, int dim);
1318  AFAPI afError af_anytrue_D(bool *d_dst,
1319  unsigned ndims, const unsigned* dims,
1320  const double *d_src, int dim);
1322  AFAPI afError af_anytrue_Z(bool *d_dst,
1323  unsigned ndims, const unsigned* dims,
1324  const cdouble *d_src, int dim);
1346  AFAPI afError af_max_vector_S(float* h_dst,
1348  unsigned numel, const float *d_src);
1350  AFAPI afError af_max_vector_B(bool* h_dst,
1351  unsigned numel, const bool *d_src);
1353  AFAPI afError af_max_vector_I(int* h_dst,
1354  unsigned numel, const int *d_src);
1356  AFAPI afError af_max_vector_U(unsigned *h_dst,
1357  unsigned numel, const unsigned *d_src);
1360  unsigned numel,
1361  const cfloat *d_src);
1363  AFAPI afError af_max_vector_D(double* h_dst,
1364  unsigned numel, const double *d_src);
1367  unsigned numel,
1368  const cdouble *d_src);
1370  AFAPI afError af_imax_vector_S(float* h_dst, int *h_idx,
1371  unsigned numel, const float *d_src,
1372  bool is_baseone IS_BASEONE);
1374  AFAPI afError af_imax_vector_I(int* h_dst, int *h_idx,
1375  unsigned numel, const int *d_src,
1376  bool is_baseone IS_BASEONE);
1378  AFAPI afError af_imax_vector_U(unsigned* h_dst, int *h_idx,
1379  unsigned numel, const unsigned *d_src,
1380  bool is_baseone IS_BASEONE);
1382  AFAPI afError af_imax_vector_B(bool* h_dst, int *h_idx,
1383  unsigned numel, const bool *d_src,
1384  bool is_baseone IS_BASEONE);
1386  AFAPI afError af_imax_vector_C(cfloat* h_dst, int *h_idx,
1387  unsigned numel,
1388  const cfloat *d_src,
1389  bool is_baseone IS_BASEONE);
1391  AFAPI afError af_imax_vector_D(double* h_dst, int *h_idx,
1392  unsigned numel, const double *d_src,
1393  bool is_baseone IS_BASEONE);
1395  AFAPI afError af_imax_vector_Z(cdouble* h_dst, int *h_idx,
1396  unsigned numel,
1397  const cdouble *d_src,
1398  bool is_baseone IS_BASEONE);
1399 
1412  AFAPI afError af_max_S(float *d_dst,
1414  unsigned ndims, const unsigned* dims,
1415  const float *d_src, int dim);
1417  AFAPI afError af_max_B(bool *d_dst,
1418  unsigned ndims, const unsigned* dims,
1419  const bool *d_src, int dim);
1421  AFAPI afError af_max_I(int *d_dst,
1422  unsigned ndims, const unsigned* dims,
1423  const int *d_src, int dim);
1425  AFAPI afError af_max_U(unsigned *d_dst,
1426  unsigned ndims, const unsigned* dims,
1427  const unsigned *d_src, int dim);
1429  AFAPI afError af_max_C(cfloat *d_dst,
1430  unsigned ndims, const unsigned* dims,
1431  const cfloat *d_src, int dim);
1433  AFAPI afError af_max_D(double *d_dst,
1434  unsigned ndims, const unsigned* dims,
1435  const double *d_src, int dim);
1437  AFAPI afError af_max_Z(cdouble *d_dst,
1438  unsigned ndims, const unsigned* dims,
1439  const cdouble *d_src, int dim);
1441  AFAPI afError af_imax_S(float *d_dst, int *d_idx,
1442  unsigned ndims, const unsigned* dims,
1443  const float *d_src, int dim,
1444  bool is_baseone IS_BASEONE);
1446  AFAPI afError af_imax_I(int *d_dst, int *d_idx,
1447  unsigned ndims, const unsigned* dims,
1448  const int *d_src, int dim,
1449  bool is_baseone IS_BASEONE);
1451  AFAPI afError af_imax_U(unsigned *d_dst, int *d_idx,
1452  unsigned ndims, const unsigned* dims,
1453  const unsigned *d_src, int dim,
1454  bool is_baseone IS_BASEONE);
1456  AFAPI afError af_imax_B(bool *d_dst, int *d_idx,
1457  unsigned ndims, const unsigned* dims,
1458  const bool *d_src, int dim,
1459  bool is_baseone IS_BASEONE);
1461  AFAPI afError af_imax_C(cfloat *d_dst, int *d_idx,
1462  unsigned ndims, const unsigned* dims,
1463  const cfloat *d_src, int dim,
1464  bool is_baseone IS_BASEONE);
1466  AFAPI afError af_imax_D(double *d_dst, int *d_idx,
1467  unsigned ndims, const unsigned* dims,
1468  const double *d_src, int dim,
1469  bool is_baseone IS_BASEONE);
1471  AFAPI afError af_imax_Z(cdouble *d_dst, int *d_idx,
1472  unsigned ndims, const unsigned* dims,
1473  const cdouble *d_src, int dim,
1474  bool is_baseone IS_BASEONE);
1496  AFAPI afError af_min_vector_S(float* h_dst,
1498  unsigned numel, const float *d_src);
1500  AFAPI afError af_min_vector_B(bool* h_dst,
1501  unsigned numel, const bool *d_src);
1503  AFAPI afError af_min_vector_I(int* h_dst,
1504  unsigned numel, const int *d_src);
1506  AFAPI afError af_min_vector_U(unsigned* h_dst,
1507  unsigned numel, const unsigned *d_src);
1510  unsigned numel,
1511  const cfloat *d_src);
1513  AFAPI afError af_min_vector_D(double* h_dst,
1514  unsigned numel, const double *d_src);
1517  unsigned numel,
1518  const cdouble *d_src);
1520  AFAPI afError af_imin_vector_S(float* h_dst, int *h_idx,
1521  unsigned numel, const float *d_src,
1522  bool is_baseone IS_BASEONE);
1524  AFAPI afError af_imin_vector_I(int* h_dst, int *h_idx,
1525  unsigned numel, const int *d_src,
1526  bool is_baseone IS_BASEONE);
1528  AFAPI afError af_imin_vector_U(unsigned* h_dst, int *h_idx,
1529  unsigned numel, const unsigned *d_src,
1530  bool is_baseone IS_BASEONE);
1532  AFAPI afError af_imin_vector_B(bool* h_dst, int *h_idx,
1533  unsigned numel, const bool *d_src,
1534  bool is_baseone IS_BASEONE);
1536  AFAPI afError af_imin_vector_C(cfloat* h_dst, int *h_idx,
1537  unsigned numel,
1538  const cfloat *d_src,
1539  bool is_baseone IS_BASEONE);
1541  AFAPI afError af_imin_vector_D(double* h_dst, int *h_idx,
1542  unsigned numel, const double *d_src,
1543  bool is_baseone IS_BASEONE);
1545  AFAPI afError af_imin_vector_Z(cdouble* h_dst, int *h_idx,
1546  unsigned numel,
1547  const cdouble *d_src,
1548  bool is_baseone IS_BASEONE);
1549 
1562  AFAPI afError af_min_S(float *d_dst,
1564  unsigned ndims, const unsigned* dims,
1565  const float *d_src, int dim);
1567  AFAPI afError af_min_B(bool *d_dst,
1568  unsigned ndims, const unsigned* dims,
1569  const bool *d_src, int dim);
1571  AFAPI afError af_min_I(int *d_dst,
1572  unsigned ndims, const unsigned* dims,
1573  const int *d_src, int dim);
1575  AFAPI afError af_min_U(unsigned *d_dst,
1576  unsigned ndims, const unsigned* dims,
1577  const unsigned *d_src, int dim);
1579  AFAPI afError af_min_C(cfloat *d_dst,
1580  unsigned ndims, const unsigned* dims,
1581  const cfloat *d_src, int dim);
1583  AFAPI afError af_min_D(double *d_dst,
1584  unsigned ndims, const unsigned* dims,
1585  const double *d_src, int dim);
1587  AFAPI afError af_min_Z(cdouble *d_dst,
1588  unsigned ndims, const unsigned* dims,
1589  const cdouble *d_src, int dim);
1591  AFAPI afError af_imin_S(float *d_dst, int *d_idx,
1592  unsigned ndims, const unsigned* dims,
1593  const float *d_src, int dim,
1594  bool is_baseone IS_BASEONE);
1596  AFAPI afError af_imin_I(int *d_dst, int *d_idx,
1597  unsigned ndims, const unsigned* dims,
1598  const int *d_src, int dim,
1599  bool is_baseone IS_BASEONE);
1601  AFAPI afError af_imin_U(unsigned *d_dst, int *d_idx,
1602  unsigned ndims, const unsigned* dims,
1603  const unsigned *d_src, int dim,
1604  bool is_baseone IS_BASEONE);
1606  AFAPI afError af_imin_B(bool *d_dst, int *d_idx,
1607  unsigned ndims, const unsigned* dims,
1608  const bool *d_src, int dim,
1609  bool is_baseone IS_BASEONE);
1611  AFAPI afError af_imin_C(cfloat *d_dst, int *d_idx,
1612  unsigned ndims, const unsigned* dims,
1613  const cfloat *d_src, int dim,
1614  bool is_baseone IS_BASEONE);
1616  AFAPI afError af_imin_D(double *d_dst, int *d_idx,
1617  unsigned ndims, const unsigned* dims,
1618  const double *d_src, int dim,
1619  bool is_baseone IS_BASEONE);
1621  AFAPI afError af_imin_Z(cdouble *d_dst, int *d_idx,
1622  unsigned ndims, const unsigned* dims,
1623  const cdouble *d_src, int dim,
1624  bool is_baseone IS_BASEONE);
1646  AFAPI afError af_minmax_vector_S(float2* h_dst,
1648  unsigned numel, const float *d_src);
1650  AFAPI afError af_minmax_vector_D(double2* h_dst,
1651  unsigned numel, const double *d_src);
1652 
1663  AFAPI afError af_minmax_S(float2 *d_dst,
1665  unsigned ndims, const unsigned* dims,
1666  const float *d_src, int dim);
1668  AFAPI afError af_minmax_D(double2 *d_dst,
1669  unsigned ndims, const unsigned* dims,
1670  const double *d_src, int dim);
1691  AFAPI afError af_sum_vector_S(float* h_dst,
1693  unsigned numel, const float *d_src);
1695  AFAPI afError af_sum_vector_B(float* h_dst,
1696  unsigned numel, const bool *d_src);
1698  AFAPI afError af_sum_vector_I(int* h_dst,
1699  unsigned numel, const int *d_src);
1701  AFAPI afError af_sum_vector_U(unsigned* h_dst,
1702  unsigned numel, const unsigned *d_src);
1705  unsigned numel,
1706  const cfloat *d_src);
1708  AFAPI afError af_sum_vector_D(double* h_dst,
1709  unsigned numel, const double *d_src);
1712  unsigned numel,
1713  const cdouble *d_src);
1722  AFAPI afError af_sum_S(float *d_dst,
1724  unsigned ndims, const unsigned* dims,
1725  const float *d_src, int dim);
1727  AFAPI afError af_sum_B(float *d_dst,
1728  unsigned ndims, const unsigned* dims,
1729  const bool *d_src, int dim);
1731  AFAPI afError af_sum_I(int *d_dst,
1732  unsigned ndims, const unsigned* dims,
1733  const int *d_src, int dim);
1735  AFAPI afError af_sum_U(unsigned *d_dst,
1736  unsigned ndims, const unsigned* dims,
1737  const unsigned *d_src, int dim);
1739  AFAPI afError af_sum_C(cfloat *d_dst,
1740  unsigned ndims, const unsigned* dims,
1741  const cfloat *d_src, int dim);
1743  AFAPI afError af_sum_D(double *d_dst,
1744  unsigned ndims, const unsigned* dims,
1745  const double *d_src, int dim);
1747  AFAPI afError af_sum_Z(cdouble *d_dst,
1748  unsigned ndims, const unsigned* dims,
1749  const cdouble *d_src, int dim);
1770  AFAPI afError af_mul_vector_S(float* h_dst,
1772  unsigned numel, const float *d_src);
1774  AFAPI afError af_mul_vector_I(int* h_dst,
1775  unsigned numel, const int *d_src);
1777  AFAPI afError af_mul_vector_U(unsigned* h_dst,
1778  unsigned numel, const unsigned *d_src);
1780  AFAPI afError af_mul_vector_B(float* h_dst,
1781  unsigned numel, const bool *d_src);
1784  unsigned numel,
1785  const cfloat *d_src);
1787  AFAPI afError af_mul_vector_D(double* h_dst,
1788  unsigned numel, const double *d_src);
1791  unsigned numel,
1792  const cdouble *d_src);
1794 
1803  AFAPI afError af_mul_S(float *d_dst,
1805  unsigned ndims, const unsigned* dims,
1806  const float *d_src, int dim);
1808  AFAPI afError af_mul_I(int *d_dst,
1809  unsigned ndims, const unsigned* dims,
1810  const int *d_src, int dim);
1812  AFAPI afError af_mul_U(unsigned *d_dst,
1813  unsigned ndims, const unsigned* dims,
1814  const unsigned *d_src, int dim);
1816  AFAPI afError af_mul_B(float *d_dst,
1817  unsigned ndims, const unsigned* dims,
1818  const bool *d_src, int dim);
1820  AFAPI afError af_mul_C(cfloat *d_dst,
1821  unsigned ndims, const unsigned* dims,
1822  const cfloat *d_src, int dim);
1824  AFAPI afError af_mul_D(double *d_dst,
1825  unsigned ndims, const unsigned* dims,
1826  const double *d_src,
1827  int dim);
1829  AFAPI afError af_mul_Z(cdouble *d_dst,
1830  unsigned ndims, const unsigned* dims,
1831  const cdouble *d_src, int dim);
1852  AFAPI afError af_nnz_vector_S(unsigned* count,
1854  unsigned numel, const float* mat);
1856  AFAPI afError af_nnz_vector_B(unsigned* count,
1857  unsigned numel, const bool* mat);
1859  AFAPI afError af_nnz_vector_D(unsigned* count,
1860  unsigned numel, const double* mat);
1861 
1870  AFAPI afError af_nnz_S(unsigned* count,
1872  unsigned numel, const float* mat,
1873  unsigned batch);
1875  AFAPI afError af_nnz_B(unsigned* count,
1876  unsigned numel, const bool* mat,
1877  unsigned batch);
1879  AFAPI afError af_nnz_D(unsigned* count,
1880  unsigned numel, const double* mat,
1881  unsigned batch);
1886 #ifdef __cplusplus
1887 }
1888 #endif
1889 
1890 #ifdef __cplusplus
1891 AFAPI afError af_alltrue_vector(bool* h_dst,
1893  unsigned numel, const float *d_src);
1895 AFAPI afError af_alltrue_vector(bool* h_dst,
1896  unsigned numel, const bool *d_src);
1898 AFAPI afError af_alltrue_vector(bool* h_dst,
1899  unsigned numel, const int *d_src);
1901 AFAPI afError af_alltrue_vector(bool* h_dst,
1902  unsigned numel, const unsigned *d_src);
1904 AFAPI afError af_alltrue_vector(bool* h_dst,
1905  unsigned numel,
1906  const cfloat *d_src);
1908 AFAPI afError af_alltrue_vector(bool* h_dst,
1909  unsigned numel, const double *d_src);
1911 AFAPI afError af_alltrue_vector(bool* h_dst,
1912  unsigned numel,
1913  const cdouble *d_src);
1914 
1916 AFAPI afError af_alltrue(bool *d_dst,
1917  unsigned ndims, const unsigned* dims,
1918  const float *d_src, int dim);
1920 AFAPI afError af_alltrue(bool *d_dst,
1921  unsigned ndims, const unsigned* dims,
1922  const bool *d_src, int dim);
1924 AFAPI afError af_alltrue(bool *d_dst,
1925  unsigned ndims, const unsigned* dims,
1926  const int *d_src, int dim);
1928 AFAPI afError af_alltrue(bool *d_dst,
1929  unsigned ndims, const unsigned* dims,
1930  const unsigned *d_src, int dim);
1932 AFAPI afError af_alltrue(bool *d_dst,
1933  unsigned ndims, const unsigned* dims,
1934  const cfloat *d_src, int dim);
1936 AFAPI afError af_alltrue(bool *d_dst,
1937  unsigned ndims, const unsigned* dims,
1938  const double *d_src, int dim);
1940 AFAPI afError af_alltrue(bool *d_dst,
1941  unsigned ndims, const unsigned* dims,
1942  const cdouble *d_src, int dim);
1943 
1945 AFAPI afError af_anytrue_vector(bool* h_dst,
1946  unsigned numel, const float *d_src);
1948 AFAPI afError af_anytrue_vector(bool* h_dst,
1949  unsigned numel, const bool *d_src);
1951 AFAPI afError af_anytrue_vector(bool* h_dst,
1952  unsigned numel, const int *d_src);
1954 AFAPI afError af_anytrue_vector(bool* h_dst,
1955  unsigned numel, const unsigned *d_src);
1957 AFAPI afError af_anytrue_vector(bool* h_dst,
1958  unsigned numel,
1959  const cfloat *d_src);
1961 AFAPI afError af_anytrue_vector(bool* h_dst,
1962  unsigned numel, const double *d_src);
1964 AFAPI afError af_anytrue_vector(bool* h_dst,
1965  unsigned numel,
1966  const cdouble *d_src);
1967 
1969 AFAPI afError af_anytrue(bool *d_dst,
1970  unsigned ndims, const unsigned* dims,
1971  const float *d_src, int dim);
1973 AFAPI afError af_anytrue(bool *d_dst,
1974  unsigned ndims, const unsigned* dims,
1975  const bool *d_src, int dim);
1977 AFAPI afError af_anytrue(bool *d_dst,
1978  unsigned ndims, const unsigned* dims,
1979  const int *d_src, int dim);
1981 AFAPI afError af_anytrue(bool *d_dst,
1982  unsigned ndims, const unsigned* dims,
1983  const unsigned *d_src, int dim);
1985 AFAPI afError af_anytrue(bool *d_dst,
1986  unsigned ndims, const unsigned* dims,
1987  const cfloat *d_src, int dim);
1989 AFAPI afError af_anytrue(bool *d_dst,
1990  unsigned ndims, const unsigned* dims,
1991  const double *d_src, int dim);
1993 AFAPI afError af_anytrue(bool *d_dst,
1994  unsigned ndims, const unsigned* dims,
1995  const cdouble *d_src, int dim);
1996 
1997 
1999 AFAPI afError af_max_vector(float* h_dst,
2000  unsigned numel, const float *d_src);
2002 AFAPI afError af_max_vector(bool* h_dst,
2003  unsigned numel, const bool *d_src);
2005 AFAPI afError af_max_vector(int* h_dst,
2006  unsigned numel, const int *d_src);
2008 AFAPI afError af_max_vector(unsigned* h_dst,
2009  unsigned numel, const unsigned *d_src);
2012  unsigned numel,
2013  const cfloat *d_src);
2015 AFAPI afError af_max_vector(double* h_dst,
2016  unsigned numel, const double *d_src);
2019  unsigned numel,
2020  const cdouble *d_src);
2021 
2023 AFAPI afError af_imax_vector(float* h_dst, int *h_idx,
2024  unsigned numel, const float *d_src,
2025  bool is_baseone IS_BASEONE);
2027 AFAPI afError af_imax_vector(int* h_dst, int *h_idx,
2028  unsigned numel, const int *d_src,
2029  bool is_baseone IS_BASEONE);
2031 AFAPI afError af_imax_vector(unsigned* h_dst, int *h_idx,
2032  unsigned numel, const unsigned *d_src,
2033  bool is_baseone IS_BASEONE);
2035 AFAPI afError af_imax_vector(bool* h_dst, int *h_idx,
2036  unsigned numel, const bool *d_src,
2037  bool is_baseone IS_BASEONE);
2039 AFAPI afError af_imax_vector(cfloat* h_dst, int *h_idx,
2040  unsigned numel,
2041  const cfloat *d_src,
2042  bool is_baseone IS_BASEONE);
2044 AFAPI afError af_imax_vector(double* h_dst, int *h_idx,
2045  unsigned numel, const double *d_src,
2046  bool is_baseone IS_BASEONE);
2048 AFAPI afError af_imax_vector(cdouble* h_dst, int *h_idx,
2049  unsigned numel,
2050  const cdouble *d_src,
2051  bool is_baseone IS_BASEONE);
2052 
2054 AFAPI afError af_max(float *d_dst,
2055  unsigned ndims, const unsigned* dims,
2056  const float *d_src, int dim);
2058 AFAPI afError af_max(bool *d_dst,
2059  unsigned ndims, const unsigned* dims,
2060  const bool *d_src, int dim);
2062 AFAPI afError af_max(int *d_dst,
2063  unsigned ndims, const unsigned* dims,
2064  const int *d_src, int dim);
2066 AFAPI afError af_max(unsigned *d_dst,
2067  unsigned ndims, const unsigned* dims,
2068  const unsigned *d_src, int dim);
2070 AFAPI afError af_max(cfloat *d_dst,
2071  unsigned ndims, const unsigned* dims,
2072  const cfloat *d_src, int dim);
2074 AFAPI afError af_max(double *d_dst,
2075  unsigned ndims, const unsigned* dims,
2076  const double *d_src, int dim);
2078 AFAPI afError af_max(cdouble *d_dst,
2079  unsigned ndims, const unsigned* dims,
2080  const cdouble *d_src, int dim);
2081 
2083 AFAPI afError af_imax(float *d_dst, int *d_idx,
2084  unsigned ndims, const unsigned* dims,
2085  const float *d_src, int dim,
2086  bool is_baseone IS_BASEONE);
2088 AFAPI afError af_imax(int *d_dst, int *d_idx,
2089  unsigned ndims, const unsigned* dims,
2090  const int *d_src, int dim,
2091  bool is_baseone IS_BASEONE);
2093 AFAPI afError af_imax(unsigned *d_dst, int *d_idx,
2094  unsigned ndims, const unsigned* dims,
2095  const unsigned *d_src, int dim,
2096  bool is_baseone IS_BASEONE);
2098 AFAPI afError af_imax(bool *d_dst, int *d_idx,
2099  unsigned ndims, const unsigned* dims,
2100  const bool *d_src, int dim,
2101  bool is_baseone IS_BASEONE);
2103 AFAPI afError af_imax(cfloat *d_dst, int *d_idx,
2104  unsigned ndims, const unsigned* dims,
2105  const cfloat *d_src, int dim,
2106  bool is_baseone IS_BASEONE);
2108 AFAPI afError af_imax(double *d_dst, int *d_idx,
2109  unsigned ndims, const unsigned* dims,
2110  const double *d_src, int dim,
2111  bool is_baseone IS_BASEONE);
2113 AFAPI afError af_imax(cdouble *d_dst, int *d_idx,
2114  unsigned ndims, const unsigned* dims,
2115  const cdouble *d_src, int dim,
2116  bool is_baseone IS_BASEONE);
2117 
2119 AFAPI afError af_min_vector(float* h_dst,
2120  unsigned numel, const float *d_src);
2122 AFAPI afError af_min_vector(bool* h_dst,
2123  unsigned numel, const bool *d_src);
2125 AFAPI afError af_min_vector(int* h_dst,
2126  unsigned numel, const int *d_src);
2128 AFAPI afError af_min_vector(unsigned* h_dst,
2129  unsigned numel, const unsigned *d_src);
2132  unsigned numel,
2133  const cfloat *d_src);
2135 AFAPI afError af_min_vector(double* h_dst,
2136  unsigned numel, const double *d_src);
2139  unsigned numel,
2140  const cdouble *d_src);
2141 
2143 AFAPI afError af_imin_vector(float* h_dst, int *h_idx,
2144  unsigned numel, const float *d_src,
2145  bool is_baseone IS_BASEONE);
2147 AFAPI afError af_imin_vector(int* h_dst, int *h_idx,
2148  unsigned numel, const int *d_src,
2149  bool is_baseone IS_BASEONE);
2151 AFAPI afError af_imin_vector(unsigned* h_dst, int *h_idx,
2152  unsigned numel, const unsigned *d_src,
2153  bool is_baseone IS_BASEONE);
2155 AFAPI afError af_imin_vector(bool* h_dst, int *h_idx,
2156  unsigned numel, const bool *d_src,
2157  bool is_baseone IS_BASEONE);
2159 AFAPI afError af_imin_vector(cfloat* h_dst, int *h_idx,
2160  unsigned numel,
2161  const cfloat *d_src,
2162  bool is_baseone IS_BASEONE);
2164 AFAPI afError af_imin_vector(double* h_dst, int *h_idx,
2165  unsigned numel, const double *d_src,
2166  bool is_baseone IS_BASEONE);
2168 AFAPI afError af_imin_vector(cdouble* h_dst, int *h_idx,
2169  unsigned numel,
2170  const cdouble *d_src,
2171  bool is_baseone IS_BASEONE);
2172 
2174 AFAPI afError af_min(float *d_dst,
2175  unsigned ndims, const unsigned* dims,
2176  const float *d_src, int dim);
2178 AFAPI afError af_min(bool *d_dst,
2179  unsigned ndims, const unsigned* dims,
2180  const bool *d_src, int dim);
2182 AFAPI afError af_min(int *d_dst,
2183  unsigned ndims, const unsigned* dims,
2184  const int *d_src, int dim);
2186 AFAPI afError af_min(unsigned *d_dst,
2187  unsigned ndims, const unsigned* dims,
2188  const unsigned *d_src, int dim);
2190 AFAPI afError af_min(cfloat *d_dst,
2191  unsigned ndims, const unsigned* dims,
2192  const cfloat *d_src, int dim);
2194 AFAPI afError af_min(cfloat *d_dst,
2195  unsigned ndims, const unsigned* dims,
2196  const cfloat *d_src, int dim);
2198 AFAPI afError af_min(double *d_dst,
2199  unsigned ndims, const unsigned* dims,
2200  const double *d_src, int dim);
2202 AFAPI afError af_min(cdouble *d_dst,
2203  unsigned ndims, const unsigned* dims,
2204  const cdouble *d_src, int dim);
2205 
2207 AFAPI afError af_imin(float *d_dst, int *d_idx,
2208  unsigned ndims, const unsigned* dims,
2209  const float *d_src, int dim,
2210  bool is_baseone IS_BASEONE);
2212 AFAPI afError af_imin(int *d_dst, int *d_idx,
2213  unsigned ndims, const unsigned* dims,
2214  const int *d_src, int dim,
2215  bool is_baseone IS_BASEONE);
2217 AFAPI afError af_imin(unsigned *d_dst, int *d_idx,
2218  unsigned ndims, const unsigned* dims,
2219  const unsigned *d_src, int dim,
2220  bool is_baseone IS_BASEONE);
2222 AFAPI afError af_imin(bool *d_dst, int *d_idx,
2223  unsigned ndims, const unsigned* dims,
2224  const bool *d_src, int dim,
2225  bool is_baseone IS_BASEONE);
2227 AFAPI afError af_imin(cfloat *d_dst, int *d_idx,
2228  unsigned ndims, const unsigned* dims,
2229  const cfloat *d_src, int dim,
2230  bool is_baseone IS_BASEONE);
2232 AFAPI afError af_imin(double *d_dst, int *d_idx,
2233  unsigned ndims, const unsigned* dims,
2234  const double *d_src, int dim,
2235  bool is_baseone IS_BASEONE);
2237 AFAPI afError af_imin(cdouble *d_dst, int *d_idx,
2238  unsigned ndims, const unsigned* dims,
2239  const cdouble *d_src, int dim,
2240  bool is_baseone IS_BASEONE);
2241 
2242 
2243 
2245 AFAPI afError af_minmax_vector(float2* h_dst,
2246  unsigned numel, const float *d_src);
2248 AFAPI afError af_minmax(float2 *d_dst,
2249  unsigned ndims, const unsigned* dims,
2250  const float *d_src, int dim);
2252 AFAPI afError af_minmax_vector(double2* h_dst,
2253  unsigned numel, const double *d_src);
2255 AFAPI afError af_minmax(double2 *d_dst,
2256  unsigned ndims, const unsigned* dims,
2257  const double *d_src, int dim);
2258 
2259 
2261 AFAPI afError af_sum_vector(float* h_dst,
2262  unsigned numel, const float *d_src);
2264 AFAPI afError af_sum_vector(float* h_dst,
2265  unsigned numel, const bool *d_src);
2267 AFAPI afError af_sum_vector(int* h_dst,
2268  unsigned numel, const int *d_src);
2270 AFAPI afError af_sum_vector(unsigned* h_dst,
2271  unsigned numel, const unsigned *d_src);
2274  unsigned numel,
2275  const cfloat *d_src);
2277 AFAPI afError af_sum_vector(double* h_dst,
2278  unsigned numel, const double *d_src);
2281  unsigned numel,
2282  const cdouble *d_src);
2283 
2285 AFAPI afError af_sum(float *d_dst,
2286  unsigned ndims, const unsigned* dims,
2287  const float *d_src, int dim);
2289 AFAPI afError af_sum(float *d_dst,
2290  unsigned ndims, const unsigned* dims,
2291  const bool *d_src, int dim);
2293 AFAPI afError af_sum(int *d_dst,
2294  unsigned ndims, const unsigned* dims,
2295  const int *d_src, int dim);
2297 AFAPI afError af_sum(unsigned *d_dst,
2298  unsigned ndims, const unsigned* dims,
2299  const unsigned *d_src, int dim);
2301 AFAPI afError af_sum(cfloat *d_dst,
2302  unsigned ndims, const unsigned* dims,
2303  const cfloat *d_src, int dim);
2305 AFAPI afError af_sum(double *d_dst,
2306  unsigned ndims, const unsigned* dims,
2307  const double *d_src, int dim);
2309 AFAPI afError af_sum(cdouble *d_dst,
2310  unsigned ndims, const unsigned* dims,
2311  const cdouble *d_src, int dim);
2312 
2313 
2315 AFAPI afError af_mul_vector(float* h_dst,
2316  unsigned numel, const float *d_src);
2318 AFAPI afError af_mul_vector(int* h_dst,
2319  unsigned numel, const int *d_src);
2321 AFAPI afError af_mul_vector(unsigned* h_dst,
2322  unsigned numel, const unsigned *d_src);
2324 AFAPI afError af_mul_vector(float* h_dst,
2325  unsigned numel, const bool *d_src);
2328  unsigned numel,
2329  const cfloat *d_src);
2331 AFAPI afError af_mul_vector(double* h_dst,
2332  unsigned numel, const double *d_src);
2335  unsigned numel,
2336  const cdouble *d_src);
2337 
2339 AFAPI afError af_mul(float *d_dst,
2340  unsigned ndims, const unsigned* dims,
2341  const float *d_src, int dim);
2343 AFAPI afError af_mul(int *d_dst,
2344  unsigned ndims, const unsigned* dims,
2345  const int *d_src, int dim);
2347 AFAPI afError af_mul(unsigned *d_dst,
2348  unsigned ndims, const unsigned* dims,
2349  const unsigned *d_src, int dim);
2351 AFAPI afError af_mul(float *d_dst,
2352  unsigned ndims, const unsigned* dims,
2353  const bool *d_src, int dim);
2355 AFAPI afError af_mul(cfloat *d_dst,
2356  unsigned ndims, const unsigned* dims,
2357  const cfloat *d_src, int dim);
2359 AFAPI afError af_mul(double *d_dst,
2360  unsigned ndims, const unsigned* dims,
2361  const double *d_src,
2362  int dim);
2364 AFAPI afError af_mul(cdouble *d_dst,
2365  unsigned ndims, const unsigned* dims,
2366  const cdouble *d_src, int dim);
2367 
2368 
2387 AFAPI afError af_segsum_S(float *d_out,
2388  unsigned numel,
2389  const float *d_in, const float *d_keys,
2390  bool reduce,
2391  unsigned batch, bool is_baseone);
2392 AFAPI afError af_segsum_D(double *d_out,
2393  unsigned numel,
2394  const double *d_in, const double *d_keys,
2395  bool reduce,
2396  unsigned batch, bool is_baseone);
2419 AFAPI afError af_accum_S(float *d_out,
2421  unsigned ndims, unsigned* dims,
2422  const float *d_in, unsigned batch,
2423  int dimension, int type, bool isupcast);
2425 AFAPI afError af_accum_D(double *d_out,
2426  unsigned ndims, unsigned* dims,
2427  const double *d_in, unsigned batch,
2428  int dimension, int type);
2430 AFAPI afError af_accum_I(int *d_out,
2431  unsigned ndims, unsigned* dims,
2432  const int *d_in, unsigned batch,
2433  int dimension, int type);
2435 AFAPI afError af_accum_U(unsigned *d_out,
2436  unsigned ndims, unsigned* dims,
2437  const unsigned *d_in, unsigned batch,
2438  int dimension, int type);
2441  unsigned ndims, unsigned* dims,
2442  const cfloat *d_in, unsigned batch,
2443  int dimension, int type, bool isupcast);
2446  unsigned ndims, unsigned* dims,
2447  const cdouble *d_in, unsigned batch,
2448  int dimension, int type);
2472 AFAPI afError af_where_BS(unsigned *n_out, float **d_indices, unsigned n_in, const bool *d_X, bool is_baseone IS_BASEONE);
2475 AFAPI afError af_where_BD(unsigned *n_out, double **d_indices, unsigned n_in, const bool *d_X, bool is_baseone IS_BASEONE);
2477 AFAPI afError af_where_BU(unsigned *n_out, unsigned **d_indices, unsigned n_in, const bool *d_X, bool is_baseone IS_BASEONE);
2479 AFAPI afError af_where_SS(unsigned *n_out, float **d_indices, unsigned n_in, const float *d_X, bool is_baseone IS_BASEONE);
2481 AFAPI afError af_where_SD(unsigned *n_out, double **d_indices, unsigned n_in, const float *d_X, bool is_baseone IS_BASEONE);
2483 AFAPI afError af_where_DD(unsigned *n_out, double **d_indices, unsigned n_in, const double *d_X, bool is_baseone IS_BASEONE);
2485 AFAPI afError af_where_UU(unsigned *n_out, unsigned **d_indices, unsigned n_in, const unsigned *d_X, bool is_baseone IS_BASEONE);
2487 AFAPI afError af_where_II(unsigned *n_out, int **d_indices, unsigned n_in, const int *d_X, bool is_baseone IS_BASEONE);
2489 
2490 
2504 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);
2507 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);
2509 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);
2511 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);
2513 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);
2515 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);
2517 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);
2530 AFAPI afError af_rand(unsigned *d_Y, unsigned numel);
2533 AFAPI afError af_rand_setseed(unsigned long long seed);
2534 
2535 
2543 AFAPI afError af_randu_S(float *d_Y, unsigned numel);
2546 AFAPI afError af_randu_D(double *d_Y, unsigned numel);
2548 inline afError af_randu_C(cfloat *d_Y, unsigned numel) { return af_randu_S((float*)d_Y, 2 * numel); }
2550 inline afError af_randu_Z(cdouble *d_Y, unsigned numel) { return af_randu_D((double*)d_Y, 2 * numel); }
2552 AFAPI afError af_randu_setseed(unsigned long long seed);
2553 
2561 AFAPI afError af_randn_S(float *d_Y, unsigned numel);
2564 AFAPI afError af_randn_D(double *d_Y, unsigned numel);
2566 inline afError af_randn_C(cfloat *d_Y, unsigned numel) { return af_randn_S((float*)d_Y, 2 * numel); }
2568 inline afError af_randn_Z(cdouble *d_Y, unsigned numel) { return af_randn_D((double*)d_Y, 2 * numel); }
2570 AFAPI afError af_randn_setseed(unsigned long long seed);
2575 // Conversion routines (used in sparse)
2576 AFAPI afError af_int_S(int *out, float *in, unsigned numel);
2577 AFAPI afError af_int_D(int *out, double *in, unsigned numel);
2578 
2579 AFAPI afError af_S_int(float *out, int *in, unsigned numel);
2580 AFAPI afError af_D_int(double *out, int *in, unsigned numel);
2581 
2582 #endif // ifdef __cplusplus
array alltrue(const array &input, int dim=-1)
Test if all elements are true (nonzero) along a dimension in input.
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=false)
Double-precision find.
afError af_sum_vector_U(unsigned *h_dst, unsigned numel, const unsigned *d_src)
sum The value of a 32-bit unsigned integer vector
afError af_imin_S(float *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const float *d_src, int dim, bool is_baseone=false)
Indexed minimum value along a dimension in single precision matrix.
afError af_alltrue_D(bool *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
all along a dimension in double precision matrix
array sum(const array &input, int dim=-1)
array segsum(const array &input, const array &segments, bool reduce=false)
void minmax(array &minvalues, array &maxvalues, const array &input, int dim=-1)
Minimum and maximum of the elements along a dimension in matrix.
afError af_nnz_B(unsigned *count, unsigned numel, const bool *mat, unsigned batch)
Number of non zero elements in a boolean (unsigned char) stream.
afError af_max_B(bool *d_dst, unsigned ndims, const unsigned *dims, const bool *d_src, int dim)
Maximum value along a dimension in boolean matrix.
afError af_alltrue_vector_S(bool *h_dst, unsigned numel, const float *d_src)
all along single precision vector
afError af_imax_vector_C(cfloat *h_dst, int *h_idx, unsigned numel, const cfloat *d_src, bool is_baseone=false)
Indexed maximum value of a single precision, complex vector.
afError af_sum_I(int *d_dst, unsigned ndims, const unsigned *dims, const int *d_src, int dim)
sum the value along a dimension in 32-bit signed integer matrix
afError af_min_D(double *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
Minimum value along a dimension in double precision matrix.
afError af_where_SS(unsigned *n_out, float **d_indices, unsigned n_in, const float *d_X, bool is_baseone=false)
Single-precision find, single-precision indexing.
array mul(const array &input, int dim=-1)
afError af_max_vector_S(float *h_dst, unsigned numel, const float *d_src)
Maximum value of a single precision vector.
afError af_sum_vector_Z(cdouble *h_dst, unsigned numel, const cdouble *d_src)
sum The value of a double precision, complex vector
afError af_min_B(bool *d_dst, unsigned ndims, const unsigned *dims, const bool *d_src, int dim)
Minimum value along a dimension in boolean matrix.
afError af_sum_U(unsigned *d_dst, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim)
sum the value along a dimension in 32-bit unsigned integer matrix
afError af_imax_Z(cdouble *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim, bool is_baseone=false)
Indexed maximum value along a dimension in double precision, cplx matrix.
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=false)
Single-precision find, single-precision indexing.
afError af_anytrue_Z(bool *d_dst, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim)
any along a dimension in double precision, complex matrix
afError af_accum_S(float *d_out, unsigned ndims, unsigned *dims, const float *d_in, unsigned batch, int dimension, int type, bool isupcast)
afError af_min_vector_Z(cdouble *h_dst, unsigned numel, const cdouble *d_src)
Minimum value of a double precision, complex vector.
array minmax_packed(const array &input, int dim=-1)
Minimum and maximum (packed) of the elements along a dimension in matrix.
afError af_imax_vector_S(float *h_dst, int *h_idx, unsigned numel, const float *d_src, bool is_baseone=false)
Indexed maximum value of a single precision vector.
afError af_accum_D(double *d_out, unsigned ndims, unsigned *dims, const double *d_in, unsigned batch, int dimension, int type)
Double precision, inclusive sum.
Definition: core.h:20
afError af_mul(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
multiplication of the values along a dimension in single precision matrix
afError af_anytrue_vector_B(bool *h_dst, unsigned numel, const bool *d_src)
any along boolean vector
afError af_max_U(unsigned *d_dst, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim)
Maximum value along a dimension in 32-bit unsigned integer matrix.
afError af_imax_vector_U(unsigned *h_dst, int *h_idx, unsigned numel, const unsigned *d_src, bool is_baseone=false)
Indexed maximum value of a 32-bit unsigned integer vector.
afError af_int_S(int *out, float *in, unsigned numel)
afError af_imax_S(float *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const float *d_src, int dim, bool is_baseone=false)
Indexed maximum value along a dimension in single precision matrix.
afError af_max(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
Maximum value along a dimension in single precision matrix.
afError af_where_UU(unsigned *n_out, unsigned **d_indices, unsigned n_in, const unsigned *d_X, bool is_baseone=false)
Unsigned integer find.
array median(const array &input, int dim=-1)
Median along a dimension.
array where(const array &input)
Indices where nonzero (zero-based indexing).
afError af_max_D(double *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
Maximum value along a dimension in double precision matrix.
afError af_min_vector(float *h_dst, unsigned numel, const float *d_src)
Minimum value of a single precision vector.
afError af_min_Z(cdouble *d_dst, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim)
Minimum value along a dimension in double precision, complex matrix.
afError af_anytrue_vector_D(bool *h_dst, unsigned numel, const double *d_src)
any along double precision vector
afError af_imin_Z(cdouble *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim, bool is_baseone=false)
Indexed minimum value along a dimension in double precision, cplx matrix.
afError af_min_vector_D(double *h_dst, unsigned numel, const double *d_src)
Minimum value of a double precision vector.
array setunion(const array &A, const array &B)
Union of two vectors.
afError af_imin_vector_I(int *h_dst, int *h_idx, unsigned numel, const int *d_src, bool is_baseone=false)
Indexed minimum value of a 32-bit signed integer vector,.
afError af_min_vector_C(cfloat *h_dst, unsigned numel, const cfloat *d_src)
Minimum value of a single precision, complex vector.
afError af_max_vector_D(double *h_dst, unsigned numel, const double *d_src)
Maximum value of a double precision vector.
afError af_alltrue_C(bool *d_dst, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim)
all along a dimension in single precision, complex matrix
afError af_randu_setseed(unsigned long long seed)
Set the seed for uniform random variable.
afError af_imin_I(int *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const int *d_src, int dim, bool is_baseone=false)
Indexed minimum value along a dimension in 32-bit signed integer matrix.
afError af_max_vector_B(bool *h_dst, unsigned numel, const bool *d_src)
Maximum value of a boolean vector.
array setunique(const array &input)
Unique values.
afError af_minmax_D(double2 *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
Minimum and maximum value along a dimension in single precision matrix.
afError af_nnz_D(unsigned *count, unsigned numel, const double *mat, unsigned batch)
Number of non zero elements in a double precision stream.
afError af_where_SD(unsigned *n_out, double **d_indices, unsigned n_in, const float *d_X, bool is_baseone=false)
Single-precision find, double-precision indexing.
afError af_anytrue_vector_C(bool *h_dst, unsigned numel, const cfloat *d_src)
any along single precision, complex vector
afError af_accum_I(int *d_out, unsigned ndims, unsigned *dims, const int *d_in, unsigned batch, int dimension, int type)
32-bit signed integer, inclusive sum
afError af_max_vector_Z(cdouble *h_dst, unsigned numel, const cdouble *d_src)
Maximum value of a double precision, complex vector.
afError af_D_int(double *out, int *in, unsigned numel)
afError af_rand(unsigned *d_Y, unsigned numel)
Generate 32-bit random integers (every bit is random). Uses af_rand_setseed.
afError af_randn_setseed(unsigned long long seed)
Set the seed for normal random variable.
afError af_imin_U(unsigned *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim, bool is_baseone=false)
Indexed minimum value along a dimension in 32-bit unsigned integer matrix.
afError af_sum_S(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
sum the value along a dimension in single precision matrix
afError af_randn_Z(cdouble *d_Y, unsigned numel)
Complex double-precision normal random variable.
Definition: core.h:2568
afError af_sum_vector_C(cfloat *h_dst, unsigned numel, const cfloat *d_src)
sum The value of a single precision, complex vector
afError af_mul_U(unsigned *d_dst, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim)
multiplication of the value along a dimension in 32-bit unsigned integer matrix
afError af_randn_S(float *d_Y, unsigned numel)
Single-precision normal random variable.
ty corrcoef(const array &x, const array &y)
Correlation coefficient of two inputs of same size.
afError af_sum_vector_I(int *h_dst, unsigned numel, const int *d_src)
sum The value of a 32-bit signed integer vector
afError
Definition: defines.h:10
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=false)
Unsigned integer find.
afError af_mul_B(float *d_dst, unsigned ndims, const unsigned *dims, const bool *d_src, int dim)
multiplication of the value along a dimension in boolean matrix
cuDoubleComplex cdouble
Definition: defines.h:109
afError af_sum_Z(cdouble *d_dst, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim)
sum the value along a dimension in double precision, complex matrix
afError af_min_I(int *d_dst, unsigned ndims, const unsigned *dims, const int *d_src, int dim)
Minimum value along a dimension in 32-bit signed integer matrix.
afError af_S_int(float *out, int *in, unsigned numel)
afError af_imax_vector_Z(cdouble *h_dst, int *h_idx, unsigned numel, const cdouble *d_src, bool is_baseone=false)
Indexed maximum value of a double precision, complex vector.
afError af_mul_vector_Z(cdouble *h_dst, unsigned numel, const cdouble *d_src)
multiplication of the values of a double precision, complex vector
afError af_alltrue_vector_U(bool *h_dst, unsigned numel, const unsigned *d_src)
all along 32-bit unsigned integer vector
afError af_where_BU(unsigned *n_out, unsigned **d_indices, unsigned n_in, const bool *d_X, bool is_baseone=false)
Boolean (8-bit) find, integer indexing.
afError af_min_C(cfloat *d_dst, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim)
Minimum value along a dimension in single precision, complex matrix.
afError af_alltrue_vector_C(bool *h_dst, unsigned numel, const cfloat *d_src)
all along single precision, complex vector
afError af_imax_U(unsigned *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim, bool is_baseone=false)
Indexed maximum value along a dimension in 32-bit signed integer matrix.
afError af_anytrue_vector_I(bool *h_dst, unsigned numel, const int *d_src)
any along 32-bit signed integer vector
afError af_max_I(int *d_dst, unsigned ndims, const unsigned *dims, const int *d_src, int dim)
Maximum value along a dimension in 32-bit signed integer matrix.
afError af_sum_D(double *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
sum the value along a dimension in double precision matrix
afError af_sum_vector_B(float *h_dst, unsigned numel, const bool *d_src)
sum The value of a boolean vector
array stdev(const array &in, int dim=-1)
Standard deviation along a dimension.
afError af_anytrue_vector_S(bool *h_dst, unsigned numel, const float *d_src)
any along single precision vector
Definition: core.h:21
afError af_alltrue_B(bool *d_dst, unsigned ndims, const unsigned *dims, const bool *d_src, int dim)
all along a dimension in boolean matrix
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=false)
Single-precision find, double-precision indexing.
afError af_min_vector_B(bool *h_dst, unsigned numel, const bool *d_src)
Minimum value of a boolean vector.
array min(const array &x, const array &y)
Minimum between x and y at every position.
afError af_alltrue_vector_B(bool *h_dst, unsigned numel, const bool *d_src)
all along boolean vector
array cov(const array &input, bool isbiased=false)
Covariance of row observations.
afError af_imax_vector(float *h_dst, int *h_idx, unsigned numel, const float *d_src, bool is_baseone=false)
Maximum value of a single precision vector.
afError af_mul_vector_D(double *h_dst, unsigned numel, const double *d_src)
multiplication of the values of a double precision vector
afError af_max_vector_I(int *h_dst, unsigned numel, const int *d_src)
Maximum value of a 32-bit signed integer vector.
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=false)
Integer find.
af_op_t
Definition: core.h:19
afError af_max_Z(cdouble *d_dst, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim)
Maximum value along a dimension in double precision, complex matrix.
afError af_accum_U(unsigned *d_out, unsigned ndims, unsigned *dims, const unsigned *d_in, unsigned batch, int dimension, int type)
32-bit unsigned integer, inclusive sum
afError af_nnz_vector_D(unsigned *count, unsigned numel, const double *mat)
Number of non zero elements in a double precision stream.
afError af_where_II(unsigned *n_out, int **d_indices, unsigned n_in, const int *d_X, bool is_baseone=false)
Integer find.
afError af_randu_Z(cdouble *d_Y, unsigned numel)
Complex double-precision uniform random variable.
Definition: core.h:2550
afError af_randn_C(cfloat *d_Y, unsigned numel)
Complex single-precision normal random variable.
Definition: core.h:2566
afError af_anytrue_vector(bool *h_dst, unsigned numel, const float *d_src)
any along single precision vector
afError af_minmax_vector_D(double2 *h_dst, unsigned numel, const double *d_src)
Minimum and maximum value of a single precision vector.
afError af_min_vector_S(float *h_dst, unsigned numel, const float *d_src)
Minimum value of a single precision vector.
afError af_where_BD(unsigned *n_out, double **d_indices, unsigned n_in, const bool *d_X, bool is_baseone=false)
Boolean (8-bit) find, double-precision indexing.
afError af_imin_vector_D(double *h_dst, int *h_idx, unsigned numel, const double *d_src, bool is_baseone=false)
Indexed minimum value of a double precision vector.
afError af_sum(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
sum the value along a dimension in single precision matrix
afError af_min_vector_U(unsigned *h_dst, unsigned numel, const unsigned *d_src)
Minimum value of a 32-bit unsigned integer vector.
afError af_imax_I(int *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const int *d_src, int dim, bool is_baseone=false)
Indexed maximum value along a dimension in 32-bit signed integer matrix.
afError af_mul_vector_I(int *h_dst, unsigned numel, const int *d_src)
multiplication of the values of a 32-bit signed integer vector
afError af_anytrue(bool *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
any along a dimension in single precision matrix
afError af_anytrue_C(bool *d_dst, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim)
any along a dimension in single precision, complex matrix
afError af_sum_vector(float *h_dst, unsigned numel, const float *d_src)
sum The value of a single precision vector
array mean(const array &input, int dim=-1)
Average along a dimension.
array accum(const array &input, int dim=-1, af_op_t op=sum_t, bool isupcast=false)
accumulated sum
afError af_anytrue_B(bool *d_dst, unsigned ndims, const unsigned *dims, const bool *d_src, int dim)
any along a dimension in boolean matrix
afError af_mul_vector_U(unsigned *h_dst, unsigned numel, const unsigned *d_src)
multiplication of the values of a 32-bit unsigned integer vector
afError af_imin_vector_S(float *h_dst, int *h_idx, unsigned numel, const float *d_src, bool is_baseone=false)
Indexed minimum value of a single precision vector,.
afError af_max_S(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
Maximum value along a dimension in single precision matrix.
afError af_nnz_vector_S(unsigned *count, unsigned numel, const float *mat)
Number of non zero elements in a single precision stream.
afError af_anytrue_I(bool *d_dst, unsigned ndims, const unsigned *dims, const int *d_src, int dim)
any along a dimension in 32-bit signed integer matrix
afError af_segsum_D(double *d_out, unsigned numel, const double *d_in, const double *d_keys, bool reduce, unsigned batch, bool is_baseone)
afError af_int_D(int *out, double *in, unsigned numel)
afError af_anytrue_vector_Z(bool *h_dst, unsigned numel, const cdouble *d_src)
any along double precision, complex vector
afError af_rand_setseed(unsigned long long seed)
Set the seed for uniform random variable.
afError af_imin_vector(float *h_dst, int *h_idx, unsigned numel, const float *d_src, bool is_baseone=false)
Minimum value of a single precision vector.
afError af_sum_C(cfloat *d_dst, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim)
sum the value along a dimension in single precision, complex matrix
afError af_anytrue_D(bool *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
any along a dimension in double precision matrix
#define AFAPI
Definition: defines.h:45
afError af_max_vector(float *h_dst, unsigned numel, const float *d_src)
Maximum value of a single precision vector.
afError af_mul_I(int *d_dst, unsigned ndims, const unsigned *dims, const int *d_src, int dim)
multiplication of the value along a dimension in 32-bit signed integer matrix
afError af_min_vector_I(int *h_dst, unsigned numel, const int *d_src)
Minimum value of a 32-bit signed integer vector.
afError af_imin_D(double *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const double *d_src, int dim, bool is_baseone=false)
Indexed minimum value along a dimension in double precision matrix.
afError af_imin_vector_B(bool *h_dst, int *h_idx, unsigned numel, const bool *d_src, bool is_baseone=false)
Indexed minimum value of a boolean vector.
afError af_mul_Z(cdouble *d_dst, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim)
multiplication of the values along a dimension in double precision, complex matrix ...
afError af_alltrue(bool *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
all along a dimension in single precision matrix
afError af_anytrue_vector_U(bool *h_dst, unsigned numel, const unsigned *d_src)
any along 32-bit unsigned integer vector
afError af_alltrue_vector_D(bool *h_dst, unsigned numel, const double *d_src)
all along double precision vector
array max(const array &x, const array &y)
Maximum between x and y at every position.
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=false)
Boolean (8-bit) find, single-precision indexing.
afError af_minmax_vector_S(float2 *h_dst, unsigned numel, const float *d_src)
Minimum and maximum value of a single precision vector.
afError af_randu_S(float *d_Y, unsigned numel)
Single-precision uniform random variable.
afError af_segsum_S(float *d_out, unsigned numel, const float *d_in, const float *d_keys, bool reduce, unsigned batch, bool is_baseone)
afError af_imax_D(double *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const double *d_src, int dim, bool is_baseone=false)
Indexed maximum value along a dimension in double precision matrix.
afError af_imax_vector_B(bool *h_dst, int *h_idx, unsigned numel, const bool *d_src, bool is_baseone=false)
Indexed maximum value of a boolean vector.
afError af_min_U(unsigned *d_dst, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim)
Minimum value along a dimension in 32-bit unsigned integer matrix.
afError af_alltrue_vector_Z(bool *h_dst, unsigned numel, const cdouble *d_src)
all along double precision, complex vector
afError af_alltrue_Z(bool *d_dst, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim)
all along a dimension in double precision, complex matrix
afError af_sum_B(float *d_dst, unsigned ndims, const unsigned *dims, const bool *d_src, int dim)
sum the value along a dimension in boolean matrix
array setintersect(const array &A, const array &B)
Intersection of two vectors.
afError af_imin_vector_U(unsigned *h_dst, int *h_idx, unsigned numel, const unsigned *d_src, bool is_baseone=false)
Indexed minimum value of a 32-bit unsigned integer vector,.
afError af_mul_S(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
multiplication of the values along a dimension in single precision matrix
array var(const array &input, bool isbiased=false, int dim=-1)
Variance along a dimension.
afError af_alltrue_I(bool *d_dst, unsigned ndims, const unsigned *dims, const int *d_src, int dim)
all along a dimension in 32-bit signed integer matrix
afError af_min_S(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
Minimum value along a dimension in single precision matrix.
#define IS_BASEONE
Definition: core.h:12
afError af_imin_vector_Z(cdouble *h_dst, int *h_idx, unsigned numel, const cdouble *d_src, bool is_baseone=false)
Indexed minimum value of a double precision, complex vector.
afError af_sum_vector_D(double *h_dst, unsigned numel, const double *d_src)
sum The value of a double precision vector
afError af_randu_C(cfloat *d_Y, unsigned numel)
Complex single-precision uniform random variable.
Definition: core.h:2548
afError af_nnz_vector_B(unsigned *count, unsigned numel, const bool *mat)
Number of non zero elements in a boolean (unsigned char) stream.
afError af_imin_C(cfloat *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim, bool is_baseone=false)
Indexed minimum value along a dimension in single precision, cplx matrix.
array anytrue(const array &input, int dim=-1)
Test if all elements are false (zero) along a dimension in input.
afError af_max_C(cfloat *d_dst, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim)
Maximum value along a dimension in single precision, complex matrix.
afError af_anytrue_S(bool *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
any along a dimension in single precision matrix
afError af_alltrue_U(bool *d_dst, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim)
all along a dimension in 32-bit unsigned integer matrix
afError af_mul_C(cfloat *d_dst, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim)
multiplication of the values along a dimension in single precision, complex matrix ...
afError af_imax(float *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const float *d_src, int dim, bool is_baseone=false)
Maximum value along a dimension in single precision matrix.
afError af_imax_vector_I(int *h_dst, int *h_idx, unsigned numel, const int *d_src, bool is_baseone=false)
Indexed maximum value of a 32-bit signed integer vector.
afError af_minmax_vector(float2 *h_dst, unsigned numel, const float *d_src)
Minimum and maximum value of a single precision vector.
afError af_mul_D(double *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
multiplication of the values along a dimension in double precision matrix
afError af_imax_vector_D(double *h_dst, int *h_idx, unsigned numel, const double *d_src, bool is_baseone=false)
Indexed maximum value of a double precision vector.
afError af_imin_B(bool *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const bool *d_src, int dim, bool is_baseone=false)
Indexed minimum value along a dimension in boolean matrix.
cuFloatComplex cfloat
Definition: defines.h:108
afError af_randu_D(double *d_Y, unsigned numel)
Double-precision uniform random variable.
afError af_mul_vector(float *h_dst, unsigned numel, const float *d_src)
multiplication of the values of a single precision vector
afError af_mul_vector_S(float *h_dst, unsigned numel, const float *d_src)
multiplication of the values of a single precision vector
afError af_max_vector_C(cfloat *h_dst, unsigned numel, const cfloat *d_src)
Maximum value of a single precision, complex vector.
afError af_imin_vector_C(cfloat *h_dst, int *h_idx, unsigned numel, const cfloat *d_src, bool is_baseone=false)
Indexed minimum value of a single precision, complex vector.
afError af_alltrue_S(bool *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
all along a dimension in single precision matrix
afError af_where_DD(unsigned *n_out, double **d_indices, unsigned n_in, const double *d_X, bool is_baseone=false)
Double-precision find.
afError af_mul_vector_B(float *h_dst, unsigned numel, const bool *d_src)
multiplication of the values of a boolean vector
afError af_sum_vector_S(float *h_dst, unsigned numel, const float *d_src)
sum The value of a single precision vector
afError af_imax_B(bool *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const bool *d_src, int dim, bool is_baseone=false)
Indexed maximum value along a dimension in boolean matrix.
afError af_alltrue_vector_I(bool *h_dst, unsigned numel, const int *d_src)
all along 32-bit signed integer vector
afError af_alltrue_vector(bool *h_dst, unsigned numel, const float *d_src)
ty dot(const array &x, const array &y)
Scalar dot product between two vectors.
afError af_min(float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
Minimum value along a dimension in single precision matrix.
afError af_anytrue_U(bool *d_dst, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim)
any along a dimension in 32-bit unsigned integer matrix
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=false)
Boolean (8-bit) find, double-precision indexing.
afError af_imin(float *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const float *d_src, int dim, bool is_baseone=false)
Minimum value along a dimension in single precision matrix.
afError af_accum_Z(cdouble *d_out, unsigned ndims, unsigned *dims, const cdouble *d_in, unsigned batch, int dimension, int type)
Complex, Double precision, inclusive sum.
afError af_where_BS(unsigned *n_out, float **d_indices, unsigned n_in, const bool *d_X, bool is_baseone=false)
Boolean (8-bit) find, single-precision indexing.
afError af_imax_C(cfloat *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim, bool is_baseone=false)
Indexed maximum value along a dimension in single precision, cplx matrix.
afError af_mul_vector_C(cfloat *h_dst, unsigned numel, const cfloat *d_src)
multiplication of the values of a single precision, complex vector
afError af_randn_D(double *d_Y, unsigned numel)
Double-precision normal random variable.
afError af_nnz_S(unsigned *count, unsigned numel, const float *mat, unsigned batch)
Number of non zero elements in a single precision stream.
afError af_accum_C(cfloat *d_out, unsigned ndims, unsigned *dims, const cfloat *d_in, unsigned batch, int dimension, int type, bool isupcast)
Complex, Single precision, inclusive sum.
afError af_minmax(float2 *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
Minimum and maximum value along a dimension in single precision matrix.
unsigned count(const array &input)
Count nonzero elements in input.
afError af_minmax_S(float2 *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
Minimum and maximum value along a dimension in single precision matrix.
afError af_max_vector_U(unsigned *h_dst, unsigned numel, const unsigned *d_src)
Maximum value of a 32-bit unsigned integer vector.