#pragma once #include const int _blocksize = 262144; void CreateMaterialMatrix(float materialValue, float freeSpaceValue, sparse_matrix_t & materialMatrix) { int * row_indx = new int[_blocksize]; float * values = new float[_blocksize]; int * col_indx = new int[_blocksize]; float value = 1 / (materialValue*freeSpaceValue); for (int i = 0; i < _blocksize; i++) { values[i] = value; col_indx[i] = i; row_indx[i] = i; } sparse_index_base_t indexSchema = SPARSE_INDEX_BASE_ZERO; sparse_matrix_t temp; sparse_status_t stat = mkl_sparse_s_create_coo(&temp, indexSchema, _blocksize, _blocksize, _blocksize, row_indx, col_indx, values); matrix_descr desc; desc.type = SPARSE_MATRIX_TYPE_GENERAL; mkl_sparse_convert_csr(temp, SPARSE_OPERATION_NON_TRANSPOSE, &materialMatrix); mkl_sparse_destroy(temp); delete[] row_indx; delete[] values; delete[] col_indx; row_indx = nullptr; values = nullptr; col_indx = nullptr; } void CreateAndDestroyMatrix() { int N_AllocatedBuffers; float materialValue = 1.f; float freespaceValue = 1.256637061E-6f; sparse_matrix_t materialMatrix; CreateMaterialMatrix(materialValue,freespaceValue, materialMatrix); mkl_sparse_destroy(materialMatrix); }