当前位置: 首页>>代码示例>>C++>>正文


C++ ArrayInfo::getType方法代码示例

本文整理汇总了C++中ArrayInfo::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayInfo::getType方法的具体用法?C++ ArrayInfo::getType怎么用?C++ ArrayInfo::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ArrayInfo的用法示例。


在下文中一共展示了ArrayInfo::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: af_arith_real

static af_err af_arith_real(af_array *out, const af_array lhs, const af_array rhs, const bool batchMode)
{
    try {

        ArrayInfo linfo = getInfo(lhs);
        ArrayInfo rinfo = getInfo(rhs);

        dim4 odims = getOutDims(linfo.dims(), rinfo.dims(), batchMode);

        const af_dtype otype = implicit(linfo.getType(), rinfo.getType());
        af_array res;
        switch (otype) {
        case f32: res = arithOp<float  , op>(lhs, rhs, odims); break;
        case f64: res = arithOp<double , op>(lhs, rhs, odims); break;
        case s32: res = arithOp<int    , op>(lhs, rhs, odims); break;
        case u32: res = arithOp<uint   , op>(lhs, rhs, odims); break;
        case u8 : res = arithOp<uchar  , op>(lhs, rhs, odims); break;
        case b8 : res = arithOp<char   , op>(lhs, rhs, odims); break;
        case s64: res = arithOp<intl   , op>(lhs, rhs, odims); break;
        case u64: res = arithOp<uintl  , op>(lhs, rhs, odims); break;
        case s16: res = arithOp<short  , op>(lhs, rhs, odims); break;
        case u16: res = arithOp<ushort , op>(lhs, rhs, odims); break;
        default: TYPE_ERROR(0, otype);
        }

        std::swap(*out, res);
    }
    CATCHALL;
    return AF_SUCCESS;
}
开发者ID:DeepCV,项目名称:arrayfire,代码行数:30,代码来源:binary.cpp

示例2: af_corrcoef

af_err af_corrcoef(double *realVal, double *imagVal, const af_array X, const af_array Y)
{
    try {
        ArrayInfo xInfo = getInfo(X);
        ArrayInfo yInfo = getInfo(Y);
        dim4 xDims      = xInfo.dims();
        dim4 yDims      = yInfo.dims();
        af_dtype xType  = xInfo.getType();
        af_dtype yType  = yInfo.getType();

        ARG_ASSERT(2, (xType==yType));
        ARG_ASSERT(2, (xDims.ndims()==yDims.ndims()));

        for (dim_t i=0; i<xDims.ndims(); ++i)
            ARG_ASSERT(2, (xDims[i]==yDims[i]));

        switch(xType) {
            case f64: *realVal = corrcoef<double, double>(X, Y); break;
            case f32: *realVal = corrcoef<float , float >(X, Y); break;
            case s32: *realVal = corrcoef<int   , float >(X, Y); break;
            case u32: *realVal = corrcoef<uint  , float >(X, Y); break;
            case s64: *realVal = corrcoef<intl  , double>(X, Y); break;
            case u64: *realVal = corrcoef<uintl , double>(X, Y); break;
            case s16: *realVal = corrcoef<short , float >(X, Y); break;
            case u16: *realVal = corrcoef<ushort, float >(X, Y); break;
            case  u8: *realVal = corrcoef<uchar , float >(X, Y); break;
            case  b8: *realVal = corrcoef<char  , float >(X, Y); break;
            default : TYPE_ERROR(1, xType);
        }
    }
    CATCHALL;
    return AF_SUCCESS;
}
开发者ID:Brainiarc7,项目名称:arrayfire,代码行数:33,代码来源:corrcoef.cpp

示例3: af_replace_scalar

af_err af_replace_scalar(af_array a, const af_array cond, const double b)
{
    try {
        ArrayInfo ainfo = getInfo(a);
        ArrayInfo cinfo = getInfo(cond);

        ARG_ASSERT(1, cinfo.getType() == b8);
        DIM_ASSERT(1, cinfo.ndims() == ainfo.ndims());

        dim4 adims = ainfo.dims();
        dim4 cdims = cinfo.dims();

        for (int i = 0; i < 4; i++) {
            DIM_ASSERT(1, cdims[i] == adims[i]);
        }

        switch (ainfo.getType()) {
        case f32: replace_scalar<float  >(a, cond, b); break;
        case f64: replace_scalar<double >(a, cond, b); break;
        case c32: replace_scalar<cfloat >(a, cond, b); break;
        case c64: replace_scalar<cdouble>(a, cond, b); break;
        case s32: replace_scalar<int    >(a, cond, b); break;
        case u32: replace_scalar<uint   >(a, cond, b); break;
        case s64: replace_scalar<intl   >(a, cond, b); break;
        case u64: replace_scalar<uintl  >(a, cond, b); break;
        case u8:  replace_scalar<uchar  >(a, cond, b); break;
        case b8:  replace_scalar<char   >(a, cond, b); break;
        default:  TYPE_ERROR(2, ainfo.getType());
        }

    } CATCHALL;
    return AF_SUCCESS;
}
开发者ID:rotorliu,项目名称:arrayfire,代码行数:33,代码来源:replace.cpp

示例4: af_matmul

af_err af_matmul(af_array *out,
                 const af_array lhs, const af_array rhs,
                 const af_mat_prop optLhs, const af_mat_prop optRhs)
{
    using namespace detail;

    try {
        ArrayInfo lhsInfo = getInfo(lhs, false, true);
        ArrayInfo rhsInfo = getInfo(rhs, true, true);

        if(lhsInfo.isSparse())
            return af_sparse_matmul(out, lhs, rhs, optLhs, optRhs);

        af_dtype lhs_type = lhsInfo.getType();
        af_dtype rhs_type = rhsInfo.getType();

        if (!(optLhs == AF_MAT_NONE ||
              optLhs == AF_MAT_TRANS ||
              optLhs == AF_MAT_CTRANS)) {
            AF_ERROR("Using this property is not yet supported in matmul", AF_ERR_NOT_SUPPORTED);
        }

        if (!(optRhs == AF_MAT_NONE ||
              optRhs == AF_MAT_TRANS ||
              optRhs == AF_MAT_CTRANS)) {
            AF_ERROR("Using this property is not yet supported in matmul", AF_ERR_NOT_SUPPORTED);
        }


        if (lhsInfo.ndims() > 2 ||
            rhsInfo.ndims() > 2) {
            AF_ERROR("matmul can not be used in batch mode", AF_ERR_BATCH);
        }

        TYPE_ASSERT(lhs_type == rhs_type);
        af_array output = 0;

        int aColDim = (optLhs == AF_MAT_NONE) ? 1 : 0;
        int bRowDim = (optRhs == AF_MAT_NONE) ? 0 : 1;

        DIM_ASSERT(1, lhsInfo.dims()[aColDim] == rhsInfo.dims()[bRowDim]);

        switch(lhs_type) {
            case f32: output = matmul<float  >(lhs, rhs, optLhs, optRhs);   break;
            case c32: output = matmul<cfloat >(lhs, rhs, optLhs, optRhs);   break;
            case f64: output = matmul<double >(lhs, rhs, optLhs, optRhs);   break;
            case c64: output = matmul<cdouble>(lhs, rhs, optLhs, optRhs);   break;
            default:  TYPE_ERROR(1, lhs_type);
        }
        std::swap(*out, output);
    }
    CATCHALL
    return AF_SUCCESS;
}
开发者ID:victorv,项目名称:arrayfire,代码行数:54,代码来源:blas.cpp

示例5: af_nearest_neighbour

af_err af_nearest_neighbour(af_array* idx, af_array* dist,
        const af_array query, const af_array train,
        const dim_t dist_dim, const uint n_dist,
        const af_match_type dist_type)
{
    try {
        ArrayInfo qInfo = getInfo(query);
        ArrayInfo tInfo = getInfo(train);
        af_dtype qType  = qInfo.getType();
        af_dtype tType  = tInfo.getType();
        af::dim4 qDims  = qInfo.dims();
        af::dim4 tDims  = tInfo.dims();

        uint train_samples = (dist_dim == 0) ? 1 : 0;

        DIM_ASSERT(2, qDims[dist_dim] == tDims[dist_dim]);
        DIM_ASSERT(2, qDims[2] == 1 && qDims[3] == 1);
        DIM_ASSERT(3, tDims[2] == 1 && tDims[3] == 1);
        DIM_ASSERT(4, (dist_dim == 0 || dist_dim == 1));
        DIM_ASSERT(5, n_dist > 0 && n_dist <= (uint)tDims[train_samples]);
        ARG_ASSERT(6, dist_type == AF_SAD || dist_type == AF_SSD || dist_type == AF_SHD);
        TYPE_ASSERT(qType == tType);

        // For Hamming, only u8, u32 and u64 allowed.
        af_array oIdx;
        af_array oDist;

        if(dist_type == AF_SHD) {
            TYPE_ASSERT(qType == u8 || qType == u32 || qType == u64);
            switch(qType) {
                case u8:  nearest_neighbour<uchar, uint>(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case u32: nearest_neighbour<uint , uint>(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case u64: nearest_neighbour<uintl, uint>(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                default : TYPE_ERROR(1, qType);
            }
        } else {
            switch(qType) {
                case f32: nearest_neighbour<float , float >(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case f64: nearest_neighbour<double, double>(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case s32: nearest_neighbour<int   , int   >(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case u32: nearest_neighbour<uint  , uint  >(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case s64: nearest_neighbour<intl  , intl  >(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case u64: nearest_neighbour<uintl , uintl >(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                case u8:  nearest_neighbour<uchar , uint  >(&oIdx, &oDist, query, train, dist_dim, n_dist, dist_type); break;
                default : TYPE_ERROR(1, qType);
            }
        }
        std::swap(*idx, oIdx);
        std::swap(*dist, oDist);
    }
    CATCHALL;

    return AF_SUCCESS;
}
开发者ID:rotorliu,项目名称:arrayfire,代码行数:54,代码来源:nearest_neighbour.cpp

示例6: af_select

af_err af_select(af_array *out, const af_array cond, const af_array a, const af_array b)
{
    try {
        ArrayInfo ainfo = getInfo(a);
        ArrayInfo binfo = getInfo(b);
        ArrayInfo cinfo = getInfo(cond);

        if(cinfo.ndims() == 0) {
            return af_retain_array(out, cond);
        }

        ARG_ASSERT(2, ainfo.getType() == binfo.getType());
        ARG_ASSERT(1, cinfo.getType() == b8);

        DIM_ASSERT(1, cinfo.ndims() == std::min(ainfo.ndims(), binfo.ndims()));

        dim4 adims = ainfo.dims();
        dim4 bdims = binfo.dims();
        dim4 cdims = cinfo.dims();
        dim4 odims(1, 1, 1, 1);

        for (int i = 0; i < 4; i++) {
            DIM_ASSERT(1, cdims[i] == std::min(adims[i], bdims[i]));
            DIM_ASSERT(2, adims[i] == bdims[i] || adims[i] == 1 || bdims[i] == 1);
            odims[i] = std::max(adims[i], bdims[i]);
        }

        af_array res;

        switch (ainfo.getType()) {
        case f32: res = select<float  >(cond, a, b, odims); break;
        case f64: res = select<double >(cond, a, b, odims); break;
        case c32: res = select<cfloat >(cond, a, b, odims); break;
        case c64: res = select<cdouble>(cond, a, b, odims); break;
        case s32: res = select<int    >(cond, a, b, odims); break;
        case u32: res = select<uint   >(cond, a, b, odims); break;
        case s64: res = select<intl   >(cond, a, b, odims); break;
        case u64: res = select<uintl  >(cond, a, b, odims); break;
        case s16: res = select<short  >(cond, a, b, odims); break;
        case u16: res = select<ushort >(cond, a, b, odims); break;
        case u8:  res = select<uchar  >(cond, a, b, odims); break;
        case b8:  res = select<char   >(cond, a, b, odims); break;
        default:  TYPE_ERROR(2, ainfo.getType());
        }

        std::swap(*out, res);
    } CATCHALL;
    return AF_SUCCESS;
}
开发者ID:victorv,项目名称:arrayfire,代码行数:49,代码来源:select.cpp

示例7: getInfo

af_err convolve2_sep(af_array *out, af_array col_filter, af_array row_filter, af_array signal)
{
    try {
        ArrayInfo sInfo = getInfo(signal);
        ArrayInfo cfInfo= getInfo(col_filter);
        ArrayInfo rfInfo= getInfo(row_filter);

        af_dtype signalType  = sInfo.getType();

        dim4 signalDims = sInfo.dims();

        ARG_ASSERT(1, (signalDims.ndims()==2 || signalDims.ndims()==3));
        ARG_ASSERT(2, cfInfo.isVector());
        ARG_ASSERT(3, rfInfo.isVector());

        af_array output;
        switch(signalType) {
            case c32: output = convolve2<cfloat ,  cfloat, expand>(signal, col_filter, row_filter); break;
            case c64: output = convolve2<cdouble, cdouble, expand>(signal, col_filter, row_filter); break;
            case f32: output = convolve2<float  ,   float, expand>(signal, col_filter, row_filter); break;
            case f64: output = convolve2<double ,  double, expand>(signal, col_filter, row_filter); break;
            case u32: output = convolve2<uint   ,   float, expand>(signal, col_filter, row_filter); break;
            case s32: output = convolve2<int    ,   float, expand>(signal, col_filter, row_filter); break;
            case u8:  output = convolve2<uchar  ,   float, expand>(signal, col_filter, row_filter); break;
            case b8:  output = convolve2<char   ,   float, expand>(signal, col_filter, row_filter); break;
            default: TYPE_ERROR(1, signalType);
        }
        std::swap(*out,output);
    }
    CATCHALL;

    return AF_SUCCESS;
}
开发者ID:EmergentOrder,项目名称:arrayfire,代码行数:33,代码来源:convolve.cpp

示例8: af_sort_index

af_err af_sort_index(af_array *out, af_array *indices, const af_array in, const unsigned dim, const bool isAscending)
{
    try {
        ArrayInfo info = getInfo(in);
        af_dtype type = info.getType();

        DIM_ASSERT(2, info.elements() > 0);
        // Only Dim 0 supported
        ARG_ASSERT(3, dim == 0);

        af_array val;
        af_array idx;

        switch(type) {
            case f32: sort_index<float  >(&val, &idx, in, dim, isAscending);  break;
            case f64: sort_index<double >(&val, &idx, in, dim, isAscending);  break;
            case s32: sort_index<int    >(&val, &idx, in, dim, isAscending);  break;
            case u32: sort_index<uint   >(&val, &idx, in, dim, isAscending);  break;
            case u8:  sort_index<uchar  >(&val, &idx, in, dim, isAscending);  break;
            case b8:  sort_index<char   >(&val, &idx, in, dim, isAscending);  break;
            default:  TYPE_ERROR(1, type);
        }
        std::swap(*out , val);
        std::swap(*indices, idx);
    }
    CATCHALL;

    return AF_SUCCESS;
}
开发者ID:EmergentOrder,项目名称:arrayfire,代码行数:29,代码来源:sort.cpp

示例9: convolve

af_err convolve(af_array *out, af_array signal, af_array filter)
{
    try {
        ArrayInfo sInfo = getInfo(signal);
        ArrayInfo fInfo = getInfo(filter);

        af_dtype stype  = sInfo.getType();

        dim4 sdims = sInfo.dims();
        dim4 fdims = fInfo.dims();

        dim_type batchDim = baseDim+1;
        ARG_ASSERT(1, (sdims.ndims()<=batchDim));
        ARG_ASSERT(2, (fdims.ndims()<=batchDim));

        ConvolveBatchKind convBT = identifyBatchKind<baseDim>(sdims.ndims(), fdims.ndims());

        af_array output;
        switch(stype) {
            case c32: output = convolve<cfloat ,  cfloat, baseDim, expand>(signal, filter, convBT); break;
            case c64: output = convolve<cdouble, cdouble, baseDim, expand>(signal, filter, convBT); break;
            case f32: output = convolve<float  ,   float, baseDim, expand>(signal, filter, convBT); break;
            case f64: output = convolve<double ,  double, baseDim, expand>(signal, filter, convBT); break;
            case u32: output = convolve<uint   ,   float, baseDim, expand>(signal, filter, convBT); break;
            case s32: output = convolve<int    ,   float, baseDim, expand>(signal, filter, convBT); break;
            case u8:  output = convolve<uchar  ,   float, baseDim, expand>(signal, filter, convBT); break;
            case b8:  output = convolve<char   ,   float, baseDim, expand>(signal, filter, convBT); break;
            default: TYPE_ERROR(1, stype);
        }
        std::swap(*out,output);
    }
    CATCHALL;

    return AF_SUCCESS;
}
开发者ID:EmergentOrder,项目名称:arrayfire,代码行数:35,代码来源:convolve.cpp

示例10: assign_helper

static
void assign_helper(Array<T> &out, const unsigned &ndims, const af_seq *index, const af_array &in_)
{
    ArrayInfo iInfo = getInfo(in_);
    af_dtype iType  = iInfo.getType();

    if(out.getType() == c64 || out.getType() == c32)
    {

        switch(iType) {
            case c64: assign<T, cdouble>(out, ndims, index, getArray<cdouble  >(in_));  break;
            case c32: assign<T, cfloat >(out, ndims, index, getArray<cfloat   >(in_));  break;
            default : TYPE_ERROR(1, iType); break;
        }
    }
    else
    {
        switch(iType) {
            case f64: assign<T, double >(out, ndims, index, getArray<double   >(in_));  break;
            case f32: assign<T, float  >(out, ndims, index, getArray<float    >(in_));  break;
            case s32: assign<T, int    >(out, ndims, index, getArray<int      >(in_));  break;
            case u32: assign<T, uint   >(out, ndims, index, getArray<uint     >(in_));  break;
            case s64: assign<T, intl   >(out, ndims, index, getArray<intl     >(in_));  break;
            case u64: assign<T, uintl  >(out, ndims, index, getArray<uintl    >(in_));  break;
            case u8 : assign<T, uchar  >(out, ndims, index, getArray<uchar    >(in_));  break;
            case b8 : assign<T, char   >(out, ndims, index, getArray<char     >(in_));  break;
            default : TYPE_ERROR(1, iType); break;
        }
    }
}
开发者ID:holocronweaver,项目名称:arrayfire,代码行数:30,代码来源:assign.cpp

示例11: af_sort_by_key

af_err af_sort_by_key(af_array *out_keys, af_array *out_values,
                      const af_array keys, const af_array values,
                      const unsigned dim, const bool isAscending)
{
    try {
        ArrayInfo info = getInfo(keys);
        af_dtype type = info.getType();

        ArrayInfo vinfo = getInfo(values);

        DIM_ASSERT(3, info.elements() > 0);
        DIM_ASSERT(4, info.dims() == vinfo.dims());
        // Only Dim 0 supported
        ARG_ASSERT(5, dim == 0);

        af_array oKey;
        af_array oVal;

        switch(type) {
            case f32: sort_by_key_tmplt<float  >(&oKey, &oVal, keys, values, dim, isAscending);  break;
            case f64: sort_by_key_tmplt<double >(&oKey, &oVal, keys, values, dim, isAscending);  break;
            case s32: sort_by_key_tmplt<int    >(&oKey, &oVal, keys, values, dim, isAscending);  break;
            case u32: sort_by_key_tmplt<uint   >(&oKey, &oVal, keys, values, dim, isAscending);  break;
            case u8:  sort_by_key_tmplt<uchar  >(&oKey, &oVal, keys, values, dim, isAscending);  break;
            case b8:  sort_by_key_tmplt<char   >(&oKey, &oVal, keys, values, dim, isAscending);  break;
            default:  TYPE_ERROR(1, type);
        }
        std::swap(*out_keys , oKey);
        std::swap(*out_values , oVal);
    }
    CATCHALL;

    return AF_SUCCESS;
}
开发者ID:EmergentOrder,项目名称:arrayfire,代码行数:34,代码来源:sort.cpp

示例12: getInfo

af_err plot3Wrapper(const af_window wind, const af_array P, const af_cell* const props, const fg::PlotType type=fg::FG_LINE, const fg::MarkerType marker=fg::FG_NONE)
{
    if(wind==0) {
        std::cerr<<"Not a valid window"<<std::endl;
        return AF_SUCCESS;
    }

    try {
        ArrayInfo Pinfo = getInfo(P);
        af_dtype Ptype  = Pinfo.getType();

        fg::Window* window = reinterpret_cast<fg::Window*>(wind);
        window->makeCurrent();
        fg::Plot3* plot3 = NULL;

        switch(Ptype) {
            case f32: plot3 = setup_plot3<float >(P, type, marker); break;
            case s32: plot3 = setup_plot3<int   >(P, type, marker); break;
            case u32: plot3 = setup_plot3<uint  >(P, type, marker); break;
            case s16: plot3 = setup_plot3<short >(P, type, marker); break;
            case u16: plot3 = setup_plot3<ushort>(P, type, marker); break;
            case u8 : plot3 = setup_plot3<uchar >(P, type, marker); break;
            default:  TYPE_ERROR(1, Ptype);
        }

        if (props->col>-1 && props->row>-1)
            window->draw(props->col, props->row, *plot3, props->title);
        else
            window->draw(*plot3);
    }
    CATCHALL;
    return AF_SUCCESS;
}
开发者ID:Brainiarc7,项目名称:arrayfire,代码行数:33,代码来源:plot3.cpp

示例13: af_stdev_all

af_err af_stdev_all(double *realVal, double *imagVal, const af_array in)
{
    try {
        ArrayInfo info = getInfo(in);
        af_dtype type = info.getType();
        switch(type) {
            case f64: *realVal = stdev<double, double>(in); break;
            case f32: *realVal = stdev<float , float >(in); break;
            case s32: *realVal = stdev<int   , float >(in); break;
            case u32: *realVal = stdev<uint  , float >(in); break;
            case s16: *realVal = stdev<short , float >(in); break;
            case u16: *realVal = stdev<ushort, float >(in); break;
            case s64: *realVal = stdev<intl  , double>(in); break;
            case u64: *realVal = stdev<uintl , double>(in); break;
            case  u8: *realVal = stdev<uchar , float >(in); break;
            case  b8: *realVal = stdev<char  , float >(in); break;
            // TODO: FIXME: sqrt(complex) is not present in cuda/opencl backend
            //case c32: {
            //    cfloat tmp = stdev<cfloat,cfloat>(in);
            //    *realVal = real(tmp);
            //    *imagVal = imag(tmp);
            //    } break;
            //case c64: {
            //    cdouble tmp = stdev<cdouble,cdouble>(in);
            //    *realVal = real(tmp);
            //    *imagVal = imag(tmp);
            //    } break;
            default : TYPE_ERROR(1, type);
        }
    }
    CATCHALL;
    return AF_SUCCESS;
}
开发者ID:Brainiarc7,项目名称:arrayfire,代码行数:33,代码来源:stdev.cpp

示例14: getInfo

static af_err morph3d(af_array *out, const af_array &in, const af_array &mask)
{
    try {
        ArrayInfo info = getInfo(in);
        ArrayInfo mInfo= getInfo(mask);
        af::dim4 dims  = info.dims();
        af::dim4 mdims = mInfo.dims();
        dim_type in_ndims = dims.ndims();
        dim_type mask_ndims = mdims.ndims();

        DIM_ASSERT(1, (in_ndims == 3));
        DIM_ASSERT(2, (mask_ndims == 3));

        af_array output;
        af_dtype type  = info.getType();
        switch(type) {
            case f32: output = morph3d<float , isDilation>(in, mask);       break;
            case f64: output = morph3d<double, isDilation>(in, mask);       break;
            case b8 : output = morph3d<char  , isDilation>(in, mask);       break;
            case s32: output = morph3d<int   , isDilation>(in, mask);       break;
            case u32: output = morph3d<uint  , isDilation>(in, mask);       break;
            case u8 : output = morph3d<uchar , isDilation>(in, mask);       break;
            default : TYPE_ERROR(1, type);
        }
        std::swap(*out, output);
    }
    CATCHALL;

    return AF_SUCCESS;
}
开发者ID:EmergentOrder,项目名称:arrayfire,代码行数:30,代码来源:morph.cpp

示例15: af_sort

af_err af_sort(af_array *out, const af_array in, const unsigned dim, const bool isAscending)
{
    try {
        ArrayInfo info = getInfo(in);
        af_dtype type = info.getType();

        if(info.elements() == 0) {
            return af_retain_array(out, in);
        }
        DIM_ASSERT(1, info.elements() > 0);

        af_array val;

        switch(type) {
            case f32: val = sort<float  >(in, dim, isAscending);  break;
            case f64: val = sort<double >(in, dim, isAscending);  break;
            case s32: val = sort<int    >(in, dim, isAscending);  break;
            case u32: val = sort<uint   >(in, dim, isAscending);  break;
            case s16: val = sort<short  >(in, dim, isAscending);  break;
            case u16: val = sort<ushort >(in, dim, isAscending);  break;
            case s64: val = sort<intl   >(in, dim, isAscending);  break;
            case u64: val = sort<uintl  >(in, dim, isAscending);  break;
            case u8:  val = sort<uchar  >(in, dim, isAscending);  break;
            case b8:  val = sort<char   >(in, dim, isAscending);  break;
            default:  TYPE_ERROR(1, type);
        }
        std::swap(*out, val);
    }
    CATCHALL;

    return AF_SUCCESS;
}
开发者ID:victorv,项目名称:arrayfire,代码行数:32,代码来源:sort.cpp


注:本文中的ArrayInfo::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。