matrix.h (2014-04-30 15:38:09 -0400, (build fd32605))
Go to the documentation of this file.
1 //-----------------------------------------------------------------------//
2 // Copyright (c) AccelerEyes LLC. All rights reserved. //
3 // See http://www.accelereyes.com/eula for details. //
4 // This software is distributed WITHOUT ANY WARRANTY; without even //
5 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
6 // PURPOSE. See the above copyright notices for more information. //
7 //-----------------------------------------------------------------------//
8 
9 #ifndef __AF_MATRIX_H
10 #define __AF_MATRIX_H
11 
12 #include "defines.h"
13 
14 
15 #ifdef __cplusplus
16 #define BASE_ONE =false
17 #else
18 #define BASE_ONE
19 #endif
20 
21 namespace af {
22 
23 class dim4;
24 class array;
25 
198 AFAPI array tile(const array &A, unsigned d0, unsigned d1=1, unsigned d2=1);
199 
219 AFAPI array tile(const array &A, const dim4 &dims);
244 AFAPI array flat(const array &A);
282 AFAPI array moddims(const array &A, int dim0, int dim1 = 1, int dim2 = 1, int dim3 = 1);
306 AFAPI array moddims(const array &A, const dim4 &dims);
334 AFAPI array shift(const array& in, int dim0=0, int dim1=0, int dim2=0, int dim3=0);
335 
349 AFAPI array shift(const array& in, const array& shift);
382 AFAPI array reorder(const array& in, int dim0=-1, int dim1=-1, int dim2=-1, int dim3=-1);
416 AFAPI array sort(const array& in, int dim=-1, bool isdescending=false);
417 
443 AFAPI void sort(array& values, array& indices, const array& in, int dim=-1, bool isdescending=false);
444 
468 AFAPI void sort(array& outkeys, array& outvalues, const array& keys, const array& values, bool isdescending=false);
493 AFAPI array sortdim(const array& in, int dim=0);
494 
514 AFAPI array sortdim(const array& in, int dim, unsigned norder, const int* h_order);
519 } //namespace
520 
521 #ifdef __cplusplus
522 extern "C" {
523 #endif
524 
542  unsigned w, unsigned h,
543  const cfloat *d_in, unsigned batch);
554  unsigned w, unsigned h,
555  const cdouble *d_in, unsigned batch);
570  AFAPI afError af_transpose_B(bool *d_out,
572  unsigned w, unsigned h,
573  const bool *d_in,
574  unsigned batch);
576  AFAPI afError af_transpose_I(int *d_out,
577  unsigned w, unsigned h,
578  const int *d_in,
579  unsigned batch);
581  AFAPI afError af_transpose_U(unsigned *d_out,
582  unsigned w, unsigned h,
583  const unsigned *d_in,
584  unsigned batch);
586  AFAPI afError af_transpose_S(float *d_out,
587  unsigned w, unsigned h,
588  const float *d_in,
589  unsigned batch);
591  AFAPI afError af_transpose_D(double *d_out,
592  unsigned w, unsigned h,
593  const double *d_in,
594  unsigned batch);
597  unsigned w, unsigned h,
598  const cfloat *d_in,
599  unsigned batch);
602  unsigned w, unsigned h,
603  const cdouble *d_in,
604  unsigned batch);
629 AFAPI afError af_tile_S(float *d_out,
631  unsigned ndims, const unsigned *dims,
632  const float * d_in,
633  unsigned nreps, const unsigned *reps,
634  unsigned batch);
636 AFAPI afError af_tile_D(double *d_out,
637  unsigned ndims, const unsigned *dims,
638  const double * d_in,
639  unsigned nreps, const unsigned *reps,
640  unsigned batch);
642 AFAPI afError af_tile_B(bool *d_out,
643  unsigned ndims, const unsigned *dims,
644  const bool * d_in,
645  unsigned nreps, const unsigned *reps,
646  unsigned batch);
648 AFAPI afError af_tile_U(unsigned *d_out,
649  unsigned ndims, const unsigned *dims,
650  const unsigned * d_in,
651  unsigned nreps, const unsigned *reps,
652  unsigned batch);
654 AFAPI afError af_tile_I(int *d_out,
655  unsigned ndims, const unsigned *dims,
656  const int * d_in,
657  unsigned nreps, const unsigned *reps,
658  unsigned batch);
661  unsigned ndims, const unsigned *dims,
662  const cfloat * d_in,
663  unsigned nreps, const unsigned *reps,
664  unsigned batch);
667  unsigned ndims, const unsigned *dims,
668  const cdouble * d_in,
669  unsigned nreps, const unsigned *reps,
670  unsigned batch);
671 
698 AFAPI afError af_shift_B(bool *d_out,
700  unsigned ndims,const unsigned *dims,
701  int nshifts, const int *h_shifts,
702  const bool *d_in, unsigned batch);
704 AFAPI afError af_shift_I(int *d_out,
705  unsigned ndims,const unsigned *dims,
706  int nshifts, const int *h_shifts,
707  const int *d_in, unsigned batch);
709 AFAPI afError af_shift_U(unsigned *d_out,
710  unsigned ndims,const unsigned *dims,
711  int nshifts, const int *h_shifts,
712  const unsigned *d_in, unsigned batch);
714 AFAPI afError af_shift_S(float *d_out,
715  unsigned ndims,const unsigned *dims,
716  int nshifts, const int *h_shifts,
717  const float *d_in, unsigned batch);
719 AFAPI afError af_shift_D(double *d_out,
720  unsigned ndims,const unsigned *dims,
721  int nshifts, const int *h_shifts,
722  const double *d_in, unsigned batch);
725  unsigned ndims,const unsigned *dims,
726  int nshifts, const int *h_shifts,
727  const cfloat *d_in, unsigned batch);
730  unsigned ndims,const unsigned *dims,
731  int nshifts, const int *h_shifts,
732  const cdouble *d_in, unsigned batch);
733 
738 // FIXME: add documentation
739 AFAPI afError af_join_B(bool *d_out,
740  unsigned ndims_A, const unsigned *dims_A, bool *d_A,
741  unsigned ndims_B, const unsigned *dims_B, bool *d_B,
742  unsigned dim);
743 AFAPI afError af_join_S(float *d_out,
744  unsigned ndims_A, const unsigned *dims_A, float *d_A,
745  unsigned ndims_B, const unsigned *dims_B, float *d_B,
746  unsigned dim);
747 AFAPI afError af_join_D(double *d_out,
748  unsigned ndims_A, const unsigned *dims_A, double *d_A,
749  unsigned ndims_B, const unsigned *dims_B, double *d_B,
750  unsigned dim);
752  unsigned ndims_A, const unsigned *dims_A, cfloat *d_A,
753  unsigned ndims_B, const unsigned *dims_B, cfloat *d_B,
754  unsigned dim);
756  unsigned ndims_A, const unsigned *dims_A, cdouble *d_A,
757  unsigned ndims_B, const unsigned *dims_B, cdouble *d_B,
758  unsigned dim);
759 AFAPI afError af_join_I(int *d_out,
760  unsigned ndims_A, const unsigned *dims_A, int *d_A,
761  unsigned ndims_B, const unsigned *dims_B, int *d_B,
762  unsigned dim);
763 AFAPI afError af_join_U(unsigned *d_out,
764  unsigned ndims_A, const unsigned *dims_A, unsigned *d_A,
765  unsigned ndims_B, const unsigned *dims_B, unsigned *d_B,
766  unsigned dim);
767 
790 AFAPI afError af_shiftd_B(bool *d_out,
792  unsigned ndims,const unsigned *dims,
793  int nshifts, const int *d_shifts,
794  const bool *d_in, unsigned batch,
795  unsigned batch_shift);
797 AFAPI afError af_shiftd_I(int *d_out,
798  unsigned ndims,const unsigned *dims,
799  int nshifts, const int *d_shifts,
800  const int *d_in, unsigned batch,
801  unsigned batch_shift);
803 AFAPI afError af_shiftd_U(unsigned *d_out,
804  unsigned ndims,const unsigned *dims,
805  int nshifts, const int *d_shifts,
806  const unsigned *d_in, unsigned batch,
807  unsigned batch_shift);
809 AFAPI afError af_shiftd_S(float *d_out,
810  unsigned ndims,const unsigned *dims,
811  int nshifts, const int *d_shifts,
812  const float *d_in, unsigned batch,
813  unsigned batch_shift);
815 AFAPI afError af_shiftd_D(double *d_out,
816  unsigned ndims,const unsigned *dims,
817  int nshifts, const int *d_shifts,
818  const double *d_in, unsigned batch,
819  unsigned batch_shift);
822  unsigned ndims,const unsigned *dims,
823  int nshifts, const int *d_shifts,
824  const cfloat *d_in, unsigned batch,
825  unsigned batch_shift);
828  unsigned ndims,const unsigned *dims,
829  int nshifts, const int *d_shifts,
830  const cdouble *d_in, unsigned batch,
831  unsigned batch_shift);
860 AFAPI afError af_reorder_B(bool *d_out,
862  unsigned ndims, const unsigned *dims,
863  int nperms, const int *perms,
864  const bool *d_in, unsigned batch);
866 AFAPI afError af_reorder_I(int *d_out,
867  unsigned ndims, const unsigned *dims,
868  int nperms, const int *perms,
869  const int *d_in, unsigned batch);
871 AFAPI afError af_reorder_U(unsigned *d_out,
872  unsigned ndims, const unsigned *dims,
873  int nperms, const int *perms,
874  const unsigned *d_in, unsigned batch);
876 AFAPI afError af_reorder_S(float *d_out,
877  unsigned ndims, const unsigned *dims,
878  int nperms, const int *perms,
879  const float *d_in, unsigned batch);
881 AFAPI afError af_reorder_D(double *d_out,
882  unsigned ndims, const unsigned *dims,
883  int nperms, const int *perms,
884  const double *d_in, unsigned batch);
887  unsigned ndims, const unsigned *dims,
888  int nperms, const int *perms,
889  const cfloat *d_in, unsigned batch);
892  unsigned ndims, const unsigned *dims,
893  int nperms, const int *perms,
894  const cdouble *d_in, unsigned batch);
920 AFAPI afError af_sort_S(float *d_sorted, float *d_Indices,
922  unsigned ndims, const unsigned *dims,
923  float *d_input, bool DIR,
924  unsigned dim, unsigned batch,
925  bool base_one BASE_ONE);
927 AFAPI afError af_sort_D(double *d_sorted, double *d_Indices,
928  unsigned ndims, const unsigned *dims,
929  double *d_input, bool DIR,
930  unsigned dim, unsigned batch,
931  bool base_one BASE_ONE);
933 AFAPI afError af_sort_I(int *d_sorted, int *d_Indices,
934  unsigned ndims, const unsigned *dims,
935  int *d_input, bool DIR,
936  unsigned dim, unsigned batch,
937  bool base_one BASE_ONE);
939 AFAPI afError af_sort_U(unsigned *d_sorted, unsigned *d_Indices,
940  unsigned ndims, const unsigned *dims,
941  unsigned *d_input, bool DIR,
942  unsigned dim, unsigned batch,
943  bool base_one BASE_ONE);
967 AFAPI afError af_issorted_S(unsigned char *res,
969  unsigned rows, unsigned cols, const float *d_in,
970  bool is_row, unsigned batch);
972 AFAPI afError af_issorted_D(unsigned char *res,
973  unsigned rows, unsigned cols, const double *d_in,
974  bool is_row, unsigned batch);
976 AFAPI afError af_issorted_I(unsigned char *res,
977  unsigned rows, unsigned cols, const int *d_in,
978  bool is_row, unsigned batch);
980 AFAPI afError af_issorted_U(unsigned char *res,
981  unsigned rows, unsigned cols, const unsigned *d_in,
982  bool is_row, unsigned batch);
1008 AFAPI afError af_sortrows_S(float* d_Y, unsigned* d_I,
1010  unsigned rows, unsigned cols, const float* d_X,
1011  unsigned numel_C, const int* h_C);
1013 AFAPI afError af_sortrows_D(double* d_Y, unsigned* d_I,
1014  unsigned rows, unsigned cols, const double* d_X,
1015  unsigned numel_C, const int* h_C);
1039 // sort Keys
1040 AFAPI afError af_sortByKeys_S(float *d_okeys, float *d_ovals,
1041  unsigned numel,
1042  float *d_ikeys, float *d_ivals,
1043  unsigned batch,
1044  bool DIR);
1045 AFAPI afError af_sortByKeys_D(double *d_okeys, double *d_ovals,
1046  unsigned numel,
1047  double *d_ikeys, double *d_ivals,
1048  unsigned batch,
1049  bool DIR);
1054 // hankel
1055 AFAPI afError af_hankel_SSS(float *d_H, unsigned nc, float *d_C, unsigned nr, float *d_R);
1056 AFAPI afError af_hankel_CSC(cfloat *d_H, unsigned nc, float *d_C, unsigned nr, cfloat *d_R);
1057 AFAPI afError af_hankel_CCS(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, float *d_R);
1058 AFAPI afError af_hankel_CCC(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, cfloat *d_R);
1059 AFAPI afError af_hankel_SSD(float *d_H, unsigned nc, float *d_C, unsigned nr, double *d_R);
1060 AFAPI afError af_hankel_CSZ(cfloat *d_H, unsigned nc, float *d_C, unsigned nr, cdouble *d_R);
1061 AFAPI afError af_hankel_CCD(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, double *d_R);
1062 AFAPI afError af_hankel_CCZ(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, cdouble *d_R);
1063 AFAPI afError af_hankel_SDS(float *d_H, unsigned nc, double *d_C, unsigned nr, float *d_R);
1064 AFAPI afError af_hankel_CDC(cfloat *d_H, unsigned nc, double *d_C, unsigned nr, cfloat *d_R);
1065 AFAPI afError af_hankel_CZS(cfloat *d_H, unsigned nc, cdouble *d_C, unsigned nr, float *d_R);
1066 AFAPI afError af_hankel_CZC(cfloat *d_H, unsigned nc, cdouble *d_C, unsigned nr, cfloat *d_R);
1067 AFAPI afError af_hankel_DSD(double *d_H, unsigned nc, float *d_C, unsigned nr, double *d_R);
1068 AFAPI afError af_hankel_ZSZ(cdouble *d_H, unsigned nc, float *d_C, unsigned nr, cdouble *d_R);
1069 AFAPI afError af_hankel_ZCD(cdouble *d_H, unsigned nc, cfloat *d_C, unsigned nr, double *d_R);
1070 AFAPI afError af_hankel_ZCZ(cdouble *d_H, unsigned nc, cfloat *d_C, unsigned nr, cdouble *d_R);
1071 AFAPI afError af_hankel_DDS(double *d_H, unsigned nc, double *d_C, unsigned nr, float *d_R);
1072 AFAPI afError af_hankel_ZDC(cdouble *d_H, unsigned nc, double *d_C, unsigned nr, cfloat *d_R);
1073 AFAPI afError af_hankel_ZZS(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, float *d_R);
1074 AFAPI afError af_hankel_ZZC(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, cfloat *d_R);
1075 AFAPI afError af_hankel_DDD(double *d_H, unsigned nc, double *d_C, unsigned nr, double *d_R);
1076 AFAPI afError af_hankel_ZDZ(cdouble *d_H, unsigned nc, double *d_C, unsigned nr, cdouble *d_R);
1077 AFAPI afError af_hankel_ZZD(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, double *d_R);
1078 AFAPI afError af_hankel_ZZZ(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, cdouble *d_R);
1079 
1080 // Toeplitz
1081 AFAPI afError af_toeplitz_SS(unsigned numelC,
1082  float *TPLZol,
1083  unsigned numelR,
1084  float *Row,
1085  float *TPLZ,
1086  unsigned NA, unsigned NB);
1087 AFAPI afError af_toeplitz_SC(unsigned numelC,
1088  float *TPLZol,
1089  unsigned numelR,
1090  cfloat *Row,
1091  cfloat *TPLZ,
1092  unsigned NA, unsigned NB);
1093 AFAPI afError af_toeplitz_CS(unsigned numelC,
1094  cfloat *TPLZol,
1095  unsigned numelR,
1096  float *Row,
1097  cfloat *TPLZ,
1098  unsigned NA, unsigned NB);
1099 AFAPI afError af_toeplitz_CC(unsigned numelC,
1100  cfloat *TPLZol,
1101  unsigned numelR,
1102  cfloat *Row,
1103  cfloat *TPLZ,
1104  unsigned NA, unsigned NB);
1105 AFAPI afError af_toeplitz_SD(unsigned numelC,
1106  float *TPLZol,
1107  unsigned numelR,
1108  double *Row,
1109  float *TPLZ,
1110  unsigned NA, unsigned NB);
1111 AFAPI afError af_toeplitz_SZ(unsigned numelC,
1112  float *TPLZol,
1113  unsigned numelR,
1114  cdouble *Row,
1115  cfloat *TPLZ,
1116  unsigned NA, unsigned NB);
1117 AFAPI afError af_toeplitz_CD(unsigned numelC,
1118  cfloat *TPLZol,
1119  unsigned numelR,
1120  double *Row,
1121  cfloat *TPLZ,
1122  unsigned NA, unsigned NB);
1123 AFAPI afError af_toeplitz_CZ(unsigned numelC,
1124  cfloat *TPLZol,
1125  unsigned numelR,
1126  cdouble *Row,
1127  cfloat *TPLZ,
1128  unsigned NA, unsigned NB);
1129 AFAPI afError af_toeplitz_DS(unsigned numelC,
1130  double *TPLZol,
1131  unsigned numelR,
1132  float *Row,
1133  float *TPLZ,
1134  unsigned NA, unsigned NB);
1135 AFAPI afError af_toeplitz_DC(unsigned numelC,
1136  double *TPLZol,
1137  unsigned numelR,
1138  cfloat *Row,
1139  cfloat *TPLZ,
1140  unsigned NA, unsigned NB);
1141 AFAPI afError af_toeplitz_ZS(unsigned numelC,
1142  cdouble *TPLZol,
1143  unsigned numelR,
1144  float *Row,
1145  cfloat *TPLZ,
1146  unsigned NA, unsigned NB);
1147 AFAPI afError af_toeplitz_ZC(unsigned numelC,
1148  cdouble *TPLZol,
1149  unsigned numelR,
1150  cfloat *Row,
1151  cfloat *TPLZ,
1152  unsigned NA, unsigned NB);
1153 AFAPI afError af_toeplitz_DD(unsigned numelC,
1154  double *TPLZol,
1155  unsigned numelR,
1156  double *Row,
1157  double *TPLZ,
1158  unsigned NA, unsigned NB);
1159 AFAPI afError af_toeplitz_DZ(unsigned numelC,
1160  double *TPLZol,
1161  unsigned numelR,
1162  cdouble *Row,
1163  cdouble *TPLZ,
1164  unsigned NA, unsigned NB);
1165 AFAPI afError af_toeplitz_ZD(unsigned numelC,
1166  cdouble *TPLZol,
1167  unsigned numelR,
1168  double *Row,
1169  cdouble *TPLZ,
1170  unsigned NA, unsigned NB);
1171 AFAPI afError af_toeplitz_ZZ(unsigned numelC,
1172  cdouble *TPLZol,
1173  unsigned numelR,
1174  cdouble *Row,
1175  cdouble *TPLZ,
1176  unsigned NA, unsigned NB);
1177 
1178 // TRIANGULAR MATRIX
1179 AFAPI afError af_triMat_S(unsigned m, unsigned n,
1180  float *d_A, float *d_T,
1181  int diag, bool direction,
1182  unsigned batch);
1183 AFAPI afError af_triMat_C(unsigned m, unsigned n,
1184  cfloat *d_A, cfloat *d_T,
1185  int diag, bool direction,
1186  unsigned batch);
1187 AFAPI afError af_triMat_D(unsigned m, unsigned n,
1188  double *d_A, double *d_T,
1189  int diag, bool direction,
1190  unsigned batch);
1191 AFAPI afError af_triMat_Z(unsigned m, unsigned n,
1192  cdouble *d_A, cdouble *d_T,
1193  int diag, bool direction,
1194  unsigned batch);
1195 
1196 AFAPI afError af_flip_B(bool *d_out,
1197  unsigned ndims, unsigned *dims,
1198  const bool *d_in,
1199  unsigned batch, unsigned dim);
1200 
1201 AFAPI afError af_flip_S(float *d_out,
1202  unsigned ndims, unsigned *dims,
1203  const float *d_in,
1204  unsigned batch, unsigned dim);
1205 
1206 AFAPI afError af_flip_D(double *d_out,
1207  unsigned ndims, unsigned *dims,
1208  const double *d_in,
1209  unsigned batch, unsigned dim);
1210 
1211 AFAPI afError af_flip_C(cfloat *d_out,
1212  unsigned ndims, unsigned *dims,
1213  const cfloat *d_in,
1214  unsigned batch, unsigned dim);
1215 
1217  unsigned ndims, unsigned *dims,
1218  const cdouble *d_in,
1219  unsigned batch, unsigned dim);
1220 
1221 AFAPI afError af_flip_I(int *d_out,
1222  unsigned ndims, unsigned *dims,
1223  const int *d_in,
1224  unsigned batch, unsigned dim);
1225 
1226 AFAPI afError af_flip_U(unsigned *d_out,
1227  unsigned ndims, unsigned *dims,
1228  const unsigned *d_in,
1229  unsigned batch, unsigned dim);
1230 
1231 // In-place Conjugate
1232 AFAPI afError af_conj_inp_C(unsigned numel, cfloat *vals);
1233 AFAPI afError af_conj_inp_Z(unsigned numel, cdouble *vals);
1234 
1235 // In-place normalize
1236 AFAPI afError af_norm_inp_C(unsigned numel, cfloat *vals, float val);
1237 AFAPI afError af_norm_inp_Z(unsigned numel, cdouble *vals, double val);
1238 
1239 // Check if the input matrix is triangular
1240 AFAPI afError af_isTrig_B(bool *res,
1241  unsigned rows, unsigned columns,
1242  const bool *in, unsigned batch, bool dir);
1243 AFAPI afError af_isTrig_S(bool *res,
1244  unsigned rows, unsigned columns,
1245  const float *in, unsigned batch, bool dir);
1246 AFAPI afError af_isTrig_C(bool *res,
1247  unsigned rows, unsigned columns,
1248  const cfloat *in, unsigned batch, bool dir);
1249 AFAPI afError af_isTrig_D(bool *res,
1250  unsigned rows, unsigned columns,
1251  const double *in, unsigned batch, bool dir);
1252 AFAPI afError af_isTrig_Z(bool *res,
1253  unsigned rows, unsigned columns,
1254  const cdouble *in, unsigned batch, bool dir);
1255 
1256 // Check if the input matrix is symmetric
1257 AFAPI afError af_isSym_B(bool *res,
1258  unsigned width,
1259  const bool *in, unsigned batch);
1260 AFAPI afError af_isSym_S(bool *res,
1261  unsigned width,
1262  const float *in, unsigned batch);
1263 AFAPI afError af_isSym_C(bool *res,
1264  unsigned width,
1265  const cfloat *in, unsigned batch);
1266 AFAPI afError af_isSym_D(bool *res,
1267  unsigned width,
1268  const double *in, unsigned batch);
1269 AFAPI afError af_isSym_Z(bool *res,
1270  unsigned width,
1271  const cdouble *in, unsigned batch);
1272 
1273 
1274 // Check if the input matrix is hermitian
1275 AFAPI afError af_isHerm_B(bool *res,
1276  unsigned width,
1277  const bool *in, unsigned batch);
1278 AFAPI afError af_isHerm_S(bool *res,
1279  unsigned width,
1280  const float *in, unsigned batch);
1281 AFAPI afError af_isHerm_C(bool *res,
1282  unsigned width,
1283  const cfloat *in, unsigned batch);
1284 AFAPI afError af_isHerm_D(bool *res,
1285  unsigned width,
1286  const double *in, unsigned batch);
1287 AFAPI afError af_isHerm_Z(bool *res,
1288  unsigned width,
1289  const cdouble *in, unsigned batch);
1290 
1291 // Check if input vector has negative values
1292 AFAPI afError af_isneg_S(const float *d_in, unsigned n, bool *is_neg);
1293 AFAPI afError af_isneg_D(const double *d_in, unsigned n, bool *is_neg);
1294 
1295 #ifdef __cplusplus
1296 }
1297 #endif
1298 #endif // __AF_MATRIX_H
afError af_sort_D(double *d_sorted, double *d_Indices, unsigned ndims, const unsigned *dims, double *d_input, bool DIR, unsigned dim, unsigned batch, bool base_one=false)
Double-precision sort.
afError af_join_D(double *d_out, unsigned ndims_A, const unsigned *dims_A, double *d_A, unsigned ndims_B, const unsigned *dims_B, double *d_B, unsigned dim)
afError af_transpose_I(int *d_out, unsigned w, unsigned h, const int *d_in, unsigned batch)
32-bit integer transpose.
afError af_isHerm_C(bool *res, unsigned width, const cfloat *in, unsigned batch)
afError af_triMat_C(unsigned m, unsigned n, cfloat *d_A, cfloat *d_T, int diag, bool direction, unsigned batch)
afError af_flip_U(unsigned *d_out, unsigned ndims, unsigned *dims, const unsigned *d_in, unsigned batch, unsigned dim)
afError af_hankel_ZCZ(cdouble *d_H, unsigned nc, cfloat *d_C, unsigned nr, cdouble *d_R)
afError af_transpose_U(unsigned *d_out, unsigned w, unsigned h, const unsigned *d_in, unsigned batch)
32-bit unsigned integer transpose.
afError af_hankel_DSD(double *d_H, unsigned nc, float *d_C, unsigned nr, double *d_R)
afError af_isSym_D(bool *res, unsigned width, const double *in, unsigned batch)
array sort(const array &in, int dim=-1, bool isdescending=false)
Sort array along dimension.
afError af_isHerm_B(bool *res, unsigned width, const bool *in, unsigned batch)
afError af_toeplitz_DD(unsigned numelC, double *TPLZol, unsigned numelR, double *Row, double *TPLZ, unsigned NA, unsigned NB)
afError af_hankel_CSZ(cfloat *d_H, unsigned nc, float *d_C, unsigned nr, cdouble *d_R)
afError af_shift_B(bool *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *h_shifts, const bool *d_in, unsigned batch)
Boolean (8-bit) array shift.
afError af_transpose_D(double *d_out, unsigned w, unsigned h, const double *d_in, unsigned batch)
Double-precision transpose (non-conjugated).
afError af_toeplitz_SC(unsigned numelC, float *TPLZol, unsigned numelR, cfloat *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
array diag(const array &input)
Extract or form diagonal matrix.
afError af_issorted_D(unsigned char *res, unsigned rows, unsigned cols, const double *d_in, bool is_row, unsigned batch)
Double-precision issorted.
afError af_shift_D(double *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *h_shifts, const double *d_in, unsigned batch)
Double-precision array shift.
afError af_isTrig_S(bool *res, unsigned rows, unsigned columns, const float *in, unsigned batch, bool dir)
afError af_hankel_CCZ(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, cdouble *d_R)
afError af_hankel_CSC(cfloat *d_H, unsigned nc, float *d_C, unsigned nr, cfloat *d_R)
afError af_shift_U(unsigned *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *h_shifts, const unsigned *d_in, unsigned batch)
32-bit unsigned integer array shift.
afError af_hankel_SSD(float *d_H, unsigned nc, float *d_C, unsigned nr, double *d_R)
afError af_hankel_ZDZ(cdouble *d_H, unsigned nc, double *d_C, unsigned nr, cdouble *d_R)
afError af_sort_I(int *d_sorted, int *d_Indices, unsigned ndims, const unsigned *dims, int *d_input, bool DIR, unsigned dim, unsigned batch, bool base_one=false)
32-bit Integer sort.
afError af_hankel_CCC(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, cfloat *d_R)
afError af_hankel_ZZD(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, double *d_R)
afError af_transpose_S(float *d_out, unsigned w, unsigned h, const float *d_in, unsigned batch)
Single-precision transpose (non-conjugated).
afError af_sort_S(float *d_sorted, float *d_Indices, unsigned ndims, const unsigned *dims, float *d_input, bool DIR, unsigned dim, unsigned batch, bool base_one=false)
Single-precision sort.
afError af_tile_S(float *d_out, unsigned ndims, const unsigned *dims, const float *d_in, unsigned nreps, const unsigned *reps, unsigned batch)
Single-precision array replication.
afError af_isTrig_Z(bool *res, unsigned rows, unsigned columns, const cdouble *in, unsigned batch, bool dir)
afError af_shiftd_S(float *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *d_shifts, const float *d_in, unsigned batch, unsigned batch_shift)
Single-precision array shift.
array tile(const array &A, unsigned d0, unsigned d1=1, unsigned d2=1)
afError af_toeplitz_CZ(unsigned numelC, cfloat *TPLZol, unsigned numelR, cdouble *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_tile_B(bool *d_out, unsigned ndims, const unsigned *dims, const bool *d_in, unsigned nreps, const unsigned *reps, unsigned batch)
Boolean (8-bit) array replication.
afError af_toeplitz_ZS(unsigned numelC, cdouble *TPLZol, unsigned numelR, float *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_join_I(int *d_out, unsigned ndims_A, const unsigned *dims_A, int *d_A, unsigned ndims_B, const unsigned *dims_B, int *d_B, unsigned dim)
afError af_isHerm_D(bool *res, unsigned width, const double *in, unsigned batch)
afError af_isSym_S(bool *res, unsigned width, const float *in, unsigned batch)
afError af_hankel_ZCD(cdouble *d_H, unsigned nc, cfloat *d_C, unsigned nr, double *d_R)
afError af_sortByKeys_S(float *d_okeys, float *d_ovals, unsigned numel, float *d_ikeys, float *d_ivals, unsigned batch, bool DIR)
afError af_isSym_B(bool *res, unsigned width, const bool *in, unsigned batch)
afError af_hankel_CZS(cfloat *d_H, unsigned nc, cdouble *d_C, unsigned nr, float *d_R)
afError af_shift_I(int *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *h_shifts, const int *d_in, unsigned batch)
32-bit signed integer array shift.
afError
Definition: defines.h:10
afError af_hankel_SDS(float *d_H, unsigned nc, double *d_C, unsigned nr, float *d_R)
afError af_tile_C(cfloat *d_out, unsigned ndims, const unsigned *dims, const cfloat *d_in, unsigned nreps, const unsigned *reps, unsigned batch)
Complex single-precision array replication.
afError af_conj_inp_C(unsigned numel, cfloat *vals)
afError af_hankel_ZZC(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, cfloat *d_R)
cuDoubleComplex cdouble
Definition: defines.h:109
afError af_toeplitz_DZ(unsigned numelC, double *TPLZol, unsigned numelR, cdouble *Row, cdouble *TPLZ, unsigned NA, unsigned NB)
afError af_hankel_ZZS(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, float *d_R)
afError af_reorder_B(bool *d_out, unsigned ndims, const unsigned *dims, int nperms, const int *perms, const bool *d_in, unsigned batch)
Boolean (8-bit) array reorder.
afError af_isneg_S(const float *d_in, unsigned n, bool *is_neg)
afError af_toeplitz_DC(unsigned numelC, double *TPLZol, unsigned numelR, cfloat *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_isTrig_B(bool *res, unsigned rows, unsigned columns, const bool *in, unsigned batch, bool dir)
afError af_toeplitz_DS(unsigned numelC, double *TPLZol, unsigned numelR, float *Row, float *TPLZ, unsigned NA, unsigned NB)
afError af_toeplitz_SZ(unsigned numelC, float *TPLZol, unsigned numelR, cdouble *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_join_B(bool *d_out, unsigned ndims_A, const unsigned *dims_A, bool *d_A, unsigned ndims_B, const unsigned *dims_B, bool *d_B, unsigned dim)
afError af_shift_S(float *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *h_shifts, const float *d_in, unsigned batch)
Single-precision array shift.
afError af_toeplitz_CD(unsigned numelC, cfloat *TPLZol, unsigned numelR, double *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_conj_inp_Z(unsigned numel, cdouble *vals)
afError af_toeplitz_ZZ(unsigned numelC, cdouble *TPLZol, unsigned numelR, cdouble *Row, cdouble *TPLZ, unsigned NA, unsigned NB)
afError af_isSym_Z(bool *res, unsigned width, const cdouble *in, unsigned batch)
afError af_isHerm_Z(bool *res, unsigned width, const cdouble *in, unsigned batch)
afError af_hankel_CCS(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, float *d_R)
afError af_triMat_Z(unsigned m, unsigned n, cdouble *d_A, cdouble *d_T, int diag, bool direction, unsigned batch)
afError af_join_C(cfloat *d_out, unsigned ndims_A, const unsigned *dims_A, cfloat *d_A, unsigned ndims_B, const unsigned *dims_B, cfloat *d_B, unsigned dim)
afError af_ctranspose_Z(cdouble *d_out, unsigned w, unsigned h, const cdouble *d_in, unsigned batch)
Double-precision complex-conjugate transpose.
afError af_join_U(unsigned *d_out, unsigned ndims_A, const unsigned *dims_A, unsigned *d_A, unsigned ndims_B, const unsigned *dims_B, unsigned *d_B, unsigned dim)
afError af_reorder_C(cfloat *d_out, unsigned ndims, const unsigned *dims, int nperms, const int *perms, const cfloat *d_in, unsigned batch)
Complex single-precision array reorder.
afError af_shiftd_C(cfloat *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *d_shifts, const cfloat *d_in, unsigned batch, unsigned batch_shift)
Complex single-precision array shift.
afError af_norm_inp_Z(unsigned numel, cdouble *vals, double val)
afError af_shiftd_U(unsigned *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *d_shifts, const unsigned *d_in, unsigned batch, unsigned batch_shift)
32-bit unsigned integer array shift.
afError af_flip_S(float *d_out, unsigned ndims, unsigned *dims, const float *d_in, unsigned batch, unsigned dim)
afError af_hankel_SSS(float *d_H, unsigned nc, float *d_C, unsigned nr, float *d_R)
afError af_reorder_I(int *d_out, unsigned ndims, const unsigned *dims, int nperms, const int *perms, const int *d_in, unsigned batch)
Integer array reorder.
afError af_issorted_I(unsigned char *res, unsigned rows, unsigned cols, const int *d_in, bool is_row, unsigned batch)
Integer issorted.
afError af_sort_U(unsigned *d_sorted, unsigned *d_Indices, unsigned ndims, const unsigned *dims, unsigned *d_input, bool DIR, unsigned dim, unsigned batch, bool base_one=false)
32-bit Unsigned Integer sort.
afError af_join_Z(cdouble *d_out, unsigned ndims_A, const unsigned *dims_A, cdouble *d_A, unsigned ndims_B, const unsigned *dims_B, cdouble *d_B, unsigned dim)
afError af_shiftd_Z(cdouble *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *d_shifts, const cdouble *d_in, unsigned batch, unsigned batch_shift)
Complex double-precision array shift.
afError af_sortByKeys_D(double *d_okeys, double *d_ovals, unsigned numel, double *d_ikeys, double *d_ivals, unsigned batch, bool DIR)
afError af_isHerm_S(bool *res, unsigned width, const float *in, unsigned batch)
afError af_hankel_CZC(cfloat *d_H, unsigned nc, cdouble *d_C, unsigned nr, cfloat *d_R)
afError af_tile_Z(cdouble *d_out, unsigned ndims, const unsigned *dims, const cdouble *d_in, unsigned nreps, const unsigned *reps, unsigned batch)
Complex double-precision array replication.
afError af_shiftd_I(int *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *d_shifts, const int *d_in, unsigned batch, unsigned batch_shift)
32-bit signed integer array shift.
afError af_flip_C(cfloat *d_out, unsigned ndims, unsigned *dims, const cfloat *d_in, unsigned batch, unsigned dim)
array sortdim(const array &in, int dim=0)
Sort treating one dimension as keys in specific order.
array shift(const array &in, int dim0=0, int dim1=0, int dim2=0, int dim3=0)
Shift the values of an array around dimension (wrap around).
afError af_sortrows_S(float *d_Y, unsigned *d_I, unsigned rows, unsigned cols, const float *d_X, unsigned numel_C, const int *h_C)
Single-precision issorted.
afError af_reorder_D(double *d_out, unsigned ndims, const unsigned *dims, int nperms, const int *perms, const double *d_in, unsigned batch)
Double-precision array reorder.
#define AFAPI
Definition: defines.h:45
array reorder(const array &in, int dim0=-1, int dim1=-1, int dim2=-1, int dim3=-1)
Reorder dimensions of array.
afError af_tile_U(unsigned *d_out, unsigned ndims, const unsigned *dims, const unsigned *d_in, unsigned nreps, const unsigned *reps, unsigned batch)
Unsigned integer array replication.
afError af_toeplitz_ZC(unsigned numelC, cdouble *TPLZol, unsigned numelR, cfloat *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_toeplitz_SD(unsigned numelC, float *TPLZol, unsigned numelR, double *Row, float *TPLZ, unsigned NA, unsigned NB)
afError af_shiftd_D(double *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *d_shifts, const double *d_in, unsigned batch, unsigned batch_shift)
Double-precision array shift.
afError af_hankel_CCD(cfloat *d_H, unsigned nc, cfloat *d_C, unsigned nr, double *d_R)
afError af_toeplitz_CS(unsigned numelC, cfloat *TPLZol, unsigned numelR, float *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_issorted_S(unsigned char *res, unsigned rows, unsigned cols, const float *d_in, bool is_row, unsigned batch)
Single-precision issorted.
afError af_isTrig_C(bool *res, unsigned rows, unsigned columns, const cfloat *in, unsigned batch, bool dir)
afError af_hankel_CDC(cfloat *d_H, unsigned nc, double *d_C, unsigned nr, cfloat *d_R)
afError af_isTrig_D(bool *res, unsigned rows, unsigned columns, const double *in, unsigned batch, bool dir)
afError af_flip_D(double *d_out, unsigned ndims, unsigned *dims, const double *d_in, unsigned batch, unsigned dim)
afError af_toeplitz_ZD(unsigned numelC, cdouble *TPLZol, unsigned numelR, double *Row, cdouble *TPLZ, unsigned NA, unsigned NB)
array moddims(const array &A, int dim0, int dim1=1, int dim2=1, int dim3=1)
This function changes the dimensions of an array.
afError af_shift_C(cfloat *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *h_shifts, const cfloat *d_in, unsigned batch)
Complex single-precision array shift.
afError af_hankel_ZZZ(cdouble *d_H, unsigned nc, cdouble *d_C, unsigned nr, cdouble *d_R)
array flat(const array &A)
No work is done (data is simply shared) so this is effectively a noop.
afError af_isSym_C(bool *res, unsigned width, const cfloat *in, unsigned batch)
afError af_sortrows_D(double *d_Y, unsigned *d_I, unsigned rows, unsigned cols, const double *d_X, unsigned numel_C, const int *h_C)
Double-precision issorted.
afError af_triMat_D(unsigned m, unsigned n, double *d_A, double *d_T, int diag, bool direction, unsigned batch)
afError af_tile_I(int *d_out, unsigned ndims, const unsigned *dims, const int *d_in, unsigned nreps, const unsigned *reps, unsigned batch)
Integer array replication.
afError af_flip_B(bool *d_out, unsigned ndims, unsigned *dims, const bool *d_in, unsigned batch, unsigned dim)
afError af_triMat_S(unsigned m, unsigned n, float *d_A, float *d_T, int diag, bool direction, unsigned batch)
afError af_hankel_DDD(double *d_H, unsigned nc, double *d_C, unsigned nr, double *d_R)
afError af_toeplitz_SS(unsigned numelC, float *TPLZol, unsigned numelR, float *Row, float *TPLZ, unsigned NA, unsigned NB)
cuFloatComplex cfloat
Definition: defines.h:108
afError af_hankel_DDS(double *d_H, unsigned nc, double *d_C, unsigned nr, float *d_R)
afError af_issorted_U(unsigned char *res, unsigned rows, unsigned cols, const unsigned *d_in, bool is_row, unsigned batch)
Unsigned issorted.
afError af_norm_inp_C(unsigned numel, cfloat *vals, float val)
afError af_transpose_B(bool *d_out, unsigned w, unsigned h, const bool *d_in, unsigned batch)
Boolean (8-bit) transpose (non-conjugated).
afError af_toeplitz_CC(unsigned numelC, cfloat *TPLZol, unsigned numelR, cfloat *Row, cfloat *TPLZ, unsigned NA, unsigned NB)
afError af_tile_D(double *d_out, unsigned ndims, const unsigned *dims, const double *d_in, unsigned nreps, const unsigned *reps, unsigned batch)
Double-precision array replication.
afError af_isneg_D(const double *d_in, unsigned n, bool *is_neg)
afError af_hankel_ZSZ(cdouble *d_H, unsigned nc, float *d_C, unsigned nr, cdouble *d_R)
afError af_reorder_Z(cdouble *d_out, unsigned ndims, const unsigned *dims, int nperms, const int *perms, const cdouble *d_in, unsigned batch)
Complex double-precision array reorder.
afError af_transpose_Z(cdouble *d_out, unsigned w, unsigned h, const cdouble *d_in, unsigned batch)
Complex double-precision transpose (non-conjugated).
afError af_join_S(float *d_out, unsigned ndims_A, const unsigned *dims_A, float *d_A, unsigned ndims_B, const unsigned *dims_B, float *d_B, unsigned dim)
#define BASE_ONE
Definition: matrix.h:16
afError af_flip_Z(cdouble *d_out, unsigned ndims, unsigned *dims, const cdouble *d_in, unsigned batch, unsigned dim)
afError af_shift_Z(cdouble *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *h_shifts, const cdouble *d_in, unsigned batch)
Complex double-precision array shift.
afError af_reorder_S(float *d_out, unsigned ndims, const unsigned *dims, int nperms, const int *perms, const float *d_in, unsigned batch)
Single-precision array reorder.
afError af_ctranspose_C(cfloat *d_out, unsigned w, unsigned h, const cfloat *d_in, unsigned batch)
Single-precision complex-conjugate transpose.
afError af_hankel_ZDC(cdouble *d_H, unsigned nc, double *d_C, unsigned nr, cfloat *d_R)
afError af_reorder_U(unsigned *d_out, unsigned ndims, const unsigned *dims, int nperms, const int *perms, const unsigned *d_in, unsigned batch)
Unsigned integer array reorder.
afError af_transpose_C(cfloat *d_out, unsigned w, unsigned h, const cfloat *d_in, unsigned batch)
Complex single-precision transpose (non-conjugated).
afError af_flip_I(int *d_out, unsigned ndims, unsigned *dims, const int *d_in, unsigned batch, unsigned dim)
afError af_shiftd_B(bool *d_out, unsigned ndims, const unsigned *dims, int nshifts, const int *d_shifts, const bool *d_in, unsigned batch, unsigned batch_shift)
Boolean (8-bit) array shift.