MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_sparse_to_dense

Function af_sparse_to_dense

src/api/c/sparse.cpp:394–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394af_err af_sparse_to_dense(af_array *out, const af_array in) {
395 try {
396 af_array output = nullptr;
397
398 const SparseArrayBase &base = getSparseArrayBase(in);
399
400 // Dense not allowed as input -> Should never happen
401 // To convert from dense to type, use the create* functions
402 ARG_ASSERT(1, base.getStorage() != AF_STORAGE_DENSE);
403
404 switch (base.getType()) {
405 case f32:
406 output = sparseConvertStorage<float>(in, AF_STORAGE_DENSE);
407 break;
408 case f64:
409 output = sparseConvertStorage<double>(in, AF_STORAGE_DENSE);
410 break;
411 case c32:
412 output = sparseConvertStorage<cfloat>(in, AF_STORAGE_DENSE);
413 break;
414 case c64:
415 output = sparseConvertStorage<cdouble>(in, AF_STORAGE_DENSE);
416 break;
417 default: AF_ERROR("Output storage type is not valid", AF_ERR_ARG);
418 }
419 std::swap(*out, output);
420 }
421 CATCHALL;
422 return AF_SUCCESS;
423}
424
425af_err af_sparse_get_info(af_array *values, af_array *rows, af_array *cols,
426 af_storage *stype, const af_array in) {

Callers 1

denseFunction · 0.50

Calls 3

swapFunction · 0.85
getStorageMethod · 0.80
getTypeMethod · 0.45

Tested by

no test coverage detected