Esempio n. 1
0
jl_array_t *jl_new_array(jl_type_t *atype, jl_tuple_t *dims)
{
    size_t ndims = jl_tuple_len(dims);
    size_t *adims = alloca(ndims*sizeof(size_t));
    size_t i;
    for(i=0; i < ndims; i++)
        adims[i] = jl_unbox_long(jl_tupleref(dims,i));
    return _new_array(atype, ndims, adims);
}
Esempio n. 2
0
jl_array_t *jl_new_array(jl_value_t *atype, jl_value_t *dims)
{
    size_t ndims = jl_nfields(dims);
    size_t *adims = (size_t*)alloca(ndims*sizeof(size_t));
    size_t i;
    for(i=0; i < ndims; i++)
        adims[i] = jl_unbox_long(jl_fieldref(dims,i));
    return _new_array(atype, ndims, adims);
}
Esempio n. 3
0
jl_array_t *jl_new_arrayv(jl_type_t *atype, ...)
{
    va_list args;
    size_t ndims = jl_unbox_long(jl_tparam1(atype));
    size_t *adims = alloca(ndims*sizeof(size_t));
    size_t i;
    va_start(args, atype);
    for(i=0; i < ndims; i++)
        adims[i] = va_arg(args, size_t);
    va_end(args);
    return _new_array(atype, ndims, adims);
}
Esempio n. 4
0
JL_DLLEXPORT jl_array_t *jl_alloc_array_3d(jl_value_t *atype, size_t nr,
                                           size_t nc, size_t z)
{
    size_t d[3] = {nr, nc, z};
    return _new_array(atype, 3, &d[0]);
}
Esempio n. 5
0
JL_DLLEXPORT jl_array_t *jl_alloc_array_2d(jl_value_t *atype, size_t nr,
                                           size_t nc)
{
    size_t d[2] = {nr, nc};
    return _new_array(atype, 2, &d[0]);
}
Esempio n. 6
0
JL_DLLEXPORT jl_array_t *jl_alloc_array_1d(jl_value_t *atype, size_t nr)
{
    return _new_array(atype, 1, &nr);
}
Esempio n. 7
0
JL_DLLEXPORT jl_array_t *jl_new_array(jl_value_t *atype, jl_value_t *_dims)
{
    size_t ndims = jl_nfields(_dims);
    assert(is_ntuple_long(_dims));
    return _new_array(atype, ndims, (size_t*)_dims);
}
Esempio n. 8
0
jl_array_t *jl_alloc_array_2d(jl_type_t *atype, size_t nr, size_t nc)
{
    size_t d[2] = {nr, nc};
    return _new_array(atype, 2, &d[0]);
}
Esempio n. 9
0
jl_array_t *jl_alloc_array_1d(jl_type_t *atype, size_t nr)
{
    return _new_array(atype, 1, &nr);
}
Esempio n. 10
0
jl_array_t *jl_new_array_(jl_type_t *atype, uint32_t ndims, size_t *dims)
{
    return _new_array(atype, ndims, dims);
}