kernel_code
stringlengths
49
1.22M
kernel void bsort_init_manning_kv(global uint4* g_data, local uint4* l_data, global uint4* g_data_v, local uint4* l_data_v) { int dir; unsigned int id, global_start, size, stride; uint4 input1, input2, temp; uint4 input1_v, input2_v, temp_v; int4 comp; uint4 mask1 = (uint4)(1, 0, 3, 2); uint4 mask2 = (ui...
kernel void ratx4_kernel(global const float* C, global float* RB) { (RB[(((1) - 1) * (4)) + (get_global_id(0))]) = (RB[(((1) - 1) * (4)) + (get_global_id(0))]) * (C[(((3) - 1) * (4)) + (get_global_id(0))]) * (C[(((5) - 1) * (4)) + (get_global_id(0))]); (RB[(((2) - 1) * (4)) + (get_global_id(0))]) = (RB[(((2) - 1) *...
kernel void isfinite_float16(global float16* src_0, global int16* dst) { int gid = get_global_id(0); dst[gid] = (int16)(isfinite(src_0[gid])); }
kernel void unary_minus_long16(global long16* src_0, global long16* dst) { int gid = get_global_id(0); dst[gid] = -src_0[gid]; }
float linear_to_gamma_2_2(float value) { if (value > 0.003130804954f) return 1.055f * native_powr(value, (1.0f / 2.4f)) - 0.055f; return 12.92f * value; } float gamma_2_2_to_linear(float value) { if (value > 0.04045f) return native_powr((value + 0.055f) / 1.055f, 2.4f); return value / 12.92f; } kernel...
kernel void atomic_cmpxchg_write_race(global int* data) { int i = get_global_id(0); if (i == 0) { *data = 0; } atomic_cmpxchg(data, i, 42); }
constant int dims = 4; constant int sizes[4] = {50, 400, 5, 6}; constant int strides[4] = {12000, 30, 6, 1}; kernel void test(int totalElements, global float* data) { int offset = 0; int linearId = get_global_id(0); if (linearId >= totalElements) { return; } for (int d = dims - 1; d >= 0; d--) { int...
inline float squash(float x) { return (1.0 / (1.0 + exp(-x))); } __attribute__((max_global_work_dim(0))) __attribute__((max_global_work_dim(0))) kernel void bpnn_output_error(global float* restrict delta, global float* restrict target, global float* restrict output, int nj, global float* restrict err) { int j, l; ...
kernel void test_arg_2_2_kern(global float4* a0, global float4* a1, global float4* b0, global float4* b1) { float4 za = (float4)(0.75f, 0.5f, 0.25f, 0.33f); unsigned int gtid = get_global_id(0); float4 tmp0 = a0[gtid] + 0.1f + za; float4 tmp1 = a1[gtid] + 1.1f + za; b0[gtid] = (0.0f + 1.1f) * (+tmp0 + tmp1); ...
kernel void test_sub_sat_int(global int* srcA, global int* srcB, global int* dst) { int tid = get_global_id(0); int tmp = sub_sat(srcA[tid], srcB[tid]); dst[tid] = tmp; }
kernel void kernel_sin_withDD8(global float* result_sin, int N) { float t1 = 1.0; float8 t2 = t1 + (float8)(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7); int i = 0; for (i = 0; i < N; i++) { t2 = sin(t2); t2 = sin(t2); t2 = sin(t2); t2 = sin(t2); t2 = sin(t2); t2 = sin(t2); t2 = sin(t2); ...
kernel void calc_total_energy(global const double* elec_totals, global const double* emap_totals, global const double* e_internal_totals, global double* e_totals) { long pose_id = get_global_id(0); e_totals[pose_id] = elec_totals[pose_id] + emap_totals[pose_id] + e_internal_totals[pose_id]; }
kernel void invalid_float3_kernel(global float3* d_out) { const unsigned int gidx = get_global_id(0); d_out[gidx] = (float3)(__builtin_astype((2147483647), float), __builtin_astype((2147483647), float), __builtin_astype((2147483647), float)); }
typedef float float2 __attribute__((ext_vector_type(2))); typedef long long2 __attribute__((ext_vector_type(2))); typedef int int2 __attribute__((ext_vector_type(2))); kernel void foo4(long2 in, global long2* out) { *out = 5 + in; }
kernel void vec_fma(global const float* a, global const float* b, global const float* c, global float* d, int N) { int nIndex = get_global_id(0); if (nIndex >= N) return; d[nIndex] = a[nIndex] * b[nIndex] + c[nIndex]; }
kernel void nextafter_floatfloat(global float* src_0, global float* src_1, global float* dst) { int gid = get_global_id(0); dst[gid] = nextafter(src_0[gid], src_1[gid]); }
float MoroInvCNDgpu(unsigned int x) { const float a1 = 2.50662823884f; const float a2 = -18.61500062529f; const float a3 = 41.39119773534f; const float a4 = -25.44106049637f; const float b1 = -8.4735109309f; const float b2 = 23.08336743743f; const float b3 = -21.06224101826f; const float b4 = 3.13082909...
constant unsigned int N[] = {0x00000001U, 0x00000002U, 0x00000004U, 0x00000008U, 0x00000010U, 0x00000020U, 0x00000040U, 0x00000080U, 0x00000100U, 0x00000200U, 0x00000400U, 0x00000800U, 0x00001000U, 0x00002000U, 0x00004000U, 0x00008000U, 0x00010000U, 0x00020000U, 0x00040000U, 0x00080000U, 0x00100000U}; constant unsigne...
kernel void test_vpm_read(global int4* inout1, global int4* inout2) { int4 a, b, c, d, e, f, g, h, i, j; int easyStride = 3; a = inout2[0 * easyStride]; b = inout2[1 * easyStride]; c = inout2[2 * easyStride]; d = inout2[3 * easyStride]; e = inout2[4 * easyStride]; f = inout2[5 * easyStride]; g = inou...
kernel void findMin(int m, int k, int count, global int* index, global int* D, global int* out, local int* SMem) { int i = get_group_id(0); int tid = get_local_id(0); int s = get_local_size(0) / 2; int resultValue = 10000000; int resultIndex = 10000000; int indexBase = (m < 1024) ? m : 1024; for (int ...
typedef unsigned char(uchar); kernel void log_fopen(global uchar* log, local uchar* output, global uchar* storage) { uchar* input = log[get_global_id(0)]; output[get_local_id(0)] = input; barrier(0x01); int i; uchar** store; if (get_local_id(0) == 0) { for (i = 0; i < get_local_size(0); i++) { s...
int bar(global int* x) { return *x; } kernel void foo(global int* x, global int* y) { *x = bar(y); }
kernel void builtin_wrappers(global char* output, global float* input) { local int offset; global float** ptr = &input; for (int c = 0; c < 16; ++c) { input[c] = c + 1; } ++input; offset = 0; float4 r1 = vload4(offset, (*ptr)); offset = 1; float4 r2 = vload4(offset, (*ptr)); offset = 2; f...
kernel void clz_ulong(global ulong* src_0, global ulong* dst) { int gid = get_global_id(0); dst[gid] = clz(src_0[gid]); }
kernel void acosh_float2(global float2* src_0, global float2* dst) { int gid = get_global_id(0); dst[gid] = acosh(src_0[gid]); }
float form_volume(float radius); float Iq(float q, float mass_dim, float surface_dim, float cluster_rg, float primary_rg); float Iqxy(float qx, float qy, float mass_dim, float surface_dim, float cluster_rg, float primary_rg); float _mass_surface_fractal_kernel(float q, float mass_dim, float surface_dim, float cluster_r...
inline float activation(float in) { float output = in; return output; } inline float4 activation_type4(float4 in ) { float4 output = in; return output; } kernel void pool_avg(const int numel, global float* input_data, const int channels, const int height, const int width, const int pooled_height, const int p...
unsigned int rotr(unsigned int x, int n) { if (n < 32) return (x >> n) | (x << (32 - n)); return x; } unsigned int ch(unsigned int x, unsigned int y, unsigned int z) { return (x & y) ^ (~x & z); } unsigned int maj(unsigned int x, unsigned int y, unsigned int z) { return (x & y) ^ (x & z) ^ (y & z); } uns...
kernel void copy1Dfloat4(global float4* input, global float4* output) { int gid = get_global_id(0); output[gid] = input[gid]; return; }
kernel void CopyBufferToBufferMiddleRegion(global unsigned int* pDst, const global unsigned int* pSrc, unsigned int elems, unsigned int dstSshOffset, unsigned int srcSshOffset) { unsigned int gid = get_global_id(0); global unsigned int* pDstWithOffset = (global unsigned int*)((global uchar*)pDst + dstSshOffset); ...
kernel void test_atomic_add(global unsigned* ptr, unsigned val) { atomic_add(ptr, val); }
kernel void THClStorageGet(global float* res, global float* data, int index) { if (get_global_id(0) == 0) { res[0] = data[index]; } }
kernel void vload_bench_1float3(global float* src, global unsigned int* dst, unsigned int offset) { int id = (int)get_global_id(0); uint3 srcV = 0; for (int i = 0; i < 1; i++) { srcV += convert_uint3(vload3(id + (i & 0xFFFF), src + offset)); } vstore3(srcV, id, dst); }
kernel void maxCl(global const int* a, global int* maxData, const unsigned int numOfTotal) { for (size_t i = 0; i < numOfTotal; i++) { *maxData = max(*maxData, a[i]); } }
kernel void min_uchar2uchar2(global uchar2* src_0, global uchar2* src_1, global uchar2* dst) { int gid = get_global_id(0); dst[gid] = min(src_0[gid], src_1[gid]); }
kernel void reduce(global const float* g_idata, global float* g_odata, local float* sdata, const unsigned int n) { const unsigned int tid = get_local_id(0); unsigned int i = (get_group_id(0) * (get_local_size(0) * 2)) + tid; const unsigned int gridSize = get_local_size(0) * 2 * get_num_groups(0); const unsigned...
kernel void vector_add(const global float* a, const global float* b, global float* c) { c[get_global_id(0)] = a[get_global_id(0)] + b[get_global_id(0)]; }
kernel void step_float2float2(global float2* src_0, global float2* src_1, global float2* dst) { int gid = get_global_id(0); dst[gid] = step(src_0[gid], src_1[gid]); }
kernel void processData(global const int* input, unsigned int dataSize, global int* output, unsigned int outputSize) { int i = get_global_id(0); output[i] = input[i]; }
constant const sampler_t g_sampler = 0x10 | 0 | 2; kernel void halve(global float4* input, global float4* output) { unsigned int global_addr = get_global_id(0); output[global_addr] = input[global_addr] / 2; }
kernel void local_read_write_race(global int* data, local int* scratch) { int l = get_local_id(0); scratch[l] = 0; barrier(0x01); scratch[l] = l; if (l == 0) { int x = 0; for (int i = 0; i < get_local_size(0); i++) { x += scratch[i]; } *data = x; } }
kernel void addVec(global int* vecC, const global int* vecA, const global int* vecB, const unsigned int size) { unsigned int w = get_global_id(0); if (w >= size) return; vecC[w] = vecA[w] + vecB[w]; }
inline float squash(float x) { return (1.0 / (1.0 + exp(-x))); } __attribute__((max_global_work_dim(0))) __attribute__((max_global_work_dim(0))) __attribute__((max_global_work_dim(0))) __attribute__((max_global_work_dim(0))) kernel void bpnn_adjust_weights(global float* restrict delta, int ndelta, global float* rest...
int posToRow(int pos) { return (pos >> 10) & ((1 << 10) - 1); } int posToCol(int pos) { return pos & ((1 << 10) - 1); } int rowColToPos(int row, int col) { return (row << 10) | col; } int linearIdToPos(int linearId, int base) { return rowColToPos((linearId / base), (linearId % base)); } int posToOffset(int pos,...
kernel void compiler_if_else(global int* src, global int* dst) { int id = (int)get_global_id(0); dst[id] = src[id]; if (dst[id] >= 0) { dst[id] = src[id + 1]; } else { dst[id]--; } }
union BufferType { float f; unsigned int u; }; kernel void attractToCenter(global float4* pointPosition, global float4* pointAcceleration, global float* pointMass, const int numPoints, const float centerAttraction) { int p = get_global_id(0); if (p >= numPoints) return; float4 direction = pointPosition[...
kernel void test_block_5_1_kern(global int* a0, global int* a1, global int* a2, global int* a3, global int* a4, global int* b0, local int* c0, local int* c1, local int* c2, local int* c3, local int* c4) { int i; unsigned int gtid = get_global_id(0); unsigned int ltid = get_local_id(0); size_t lsz = get_local_si...
kernel void kernel_asinh_withDD1(global float* result_asinh, int N) { float t1 = 345.634; int i = 0; for (i = 0; i < N; i++) { t1 = asinh(t1); t1 = asinh(t1); t1 = asinh(t1); t1 = asinh(t1); t1 = asinh(t1); t1 = asinh(t1); t1 = asinh(t1); t1 = asinh(t1); t1 = asinh(t1); t1...
kernel void d_vector_sub(global const double* a, global const double* b, global double* c, int iNumElements) { int i = get_global_id(0); if (i >= iNumElements) { return; } c[i] = a[i] - b[i]; }
kernel void testUGreaterThanEqual(uint2 a, uint2 b, global int2* res) { res[0] = a >= b; }
kernel void kern(global float* out) { size_t i = get_global_id(0); out[i] = i; }
kernel void exp_float8(global float8* src_0, global float8* dst) { int gid = get_global_id(0); dst[gid] = exp(src_0[gid]); }
kernel void kernel_hooking(global int* d_parents, global int* d_shadow, global char* d_mask, global int* d_edge_src, global char* d_over, int iter, int edge_cnt, global int* rowptr, global int* colid, int vertex_cnt, int mid, global int* rowinfo, int start) { int tid = get_global_id(0); int getnumsum = get_global_s...
kernel void to_gray(global uchar* aBufferIn, global uchar* aBufferOut) { int global_id = get_global_id(0); int index = global_id * 4; uchar r = aBufferIn[index]; uchar g = aBufferIn[index + 1]; uchar b = aBufferIn[index + 2]; uchar gray = 0.299 * r + 0.587 * g + 0.114 * b; aBufferOut[index] = gray; aBuf...
kernel void multiplyScaler(global float* a, float b, global float* result) { int gid = get_global_id(0); result[gid] = a[gid] * b; }
kernel void fc_layer_relu(const global float* restrict pInput, const global float* restrict pWeights, global float* restrict pOutput, const int nInputs, const global float* restrict pBias, const unsigned char act) { const int x = get_global_id(0); const int idxstart = x * nInputs; float sum = 0; float zero = 0;...
kernel void bitselect_ulong4ulong4ulong4(global ulong4* src_0, global ulong4* src_1, global ulong4* src_2, global ulong4* dst) { int gid = get_global_id(0); dst[gid] = bitselect(src_0[gid], src_1[gid], src_2[gid]); }
kernel void test_shuffle_upcast(const global char8* in, const global uchar8* mask, global char8* out) { char8 result = (char8)0x17; result.s4 = shuffle(in[0], mask[0]).s6; out[0] = result; result = (char8)0x42; result.s37 = shuffle(in[1], mask[1]).s05; out[1] = result; result = (char8)0x13; resul...
kernel void native_exp2_float16(global float16* src_0, global float16* dst) { int gid = get_global_id(0); dst[gid] = native_exp2(src_0[gid]); }
kernel void compiler_bitcast_char8_to_long(global char8* src, global ulong* dst) { int tid = get_global_id(0); char8 v = src[tid]; ulong dl = __builtin_astype((v), ulong); dst[tid] = dl; }
kernel void compiler_math_3op(global float* dst, global float* src1, global float* src2, global float* src3) { int i = get_global_id(0); const float x = src1[i], y = src2[i], z = src3[i]; switch (i) { case 0: dst[i] = mad(x, y, z); break; case 1: dst[i] = fma(x, y, z); break; d...
kernel void compiler_fabs(global float* src, global float* dst) { int i = get_global_id(0); dst[i] = fabs(src[i]); }
kernel void filter_by_selection(global float8* a, global float8* b, global float8* result) { uint8 mask = (uint8)(0, -1, 0, -1, 0, -1, 0, -1); unsigned int id = get_global_id(0); float8 in1 = a[id + 1]; float8 in2 = b[id + 1]; result[id + 1] = select(in1, in2, mask); }
kernel void write_scanned_output(global unsigned int* output, global unsigned int* block_sums, const unsigned int count) { const unsigned int gid = get_global_id(0); const unsigned int block_id = get_group_id(0); if (gid < count) { output[gid] = ((block_sums[block_id]) + (output[gid])); } }
inline float POLYX(float x, float c0, float c1, float c2, float c3) { return (((((c3) * (x) + (c2)) * (x) + (c1)) * (x) + (c0)) * (x)); } kernel void rdsmh_kernel(global const float* T, global float* EG, const float TCONV) { const float TEMP = T[get_global_id(0)] * TCONV; const float TLOG = log((TEMP)); const ...
kernel void gte(global int* out, uchar a, uchar b) { out[0] = a >= b; }
kernel void FIR(global float* output, global float* coeff, global float* temp_input, unsigned int numTap) { unsigned int tid = get_global_id(0); unsigned int numData = get_global_size(0); unsigned int xid = tid + numTap - 1; float sum = 0; unsigned int i = 0; for (i = 0; i < numTap; i++) { sum += coef...
kernel void test_arg_1_8_kern(global float4* a0, global float4* b0, global float4* b1, global float4* b2, global float4* b3, global float4* b4, global float4* b5, global float4* b6, global float4* b7) { float4 za = (float4)(0.75f, 0.5f, 0.25f, 0.33f); unsigned int gtid = get_global_id(0); float4 tmp0 = a0[gtid] +...
kernel void pre_decrement_char(global char* src_0, global char* dst) { int gid = get_global_id(0); dst[gid] = --src_0[gid]; }
kernel void xcorr(global int* in1, global int* in2, global int* out) { int offset = get_global_id(0); int len = get_global_size(0); int res = 0, i = 0; do { res += in1[i] * in2[i + offset]; i++; } while (i != len); out[offset] = res; }
kernel void compiler_lower_return2(global int* src, global int* dst) { const int id = get_global_id(0); dst[id] = id; while (dst[id] > src[id]) { if (dst[id] > 10) return; dst[id]--; } dst[id] += 2; }
kernel void kernel_doAdd_vector_float(int count, global float* result) { int bulkCount = count >> 6; int threadID = get_local_id(0); for (int i = 0; i < bulkCount; i++) { float4 value; value.x = i; value.y = value.x + 1.0f; value.z = value.x + 2.0f; value.w = value.x + 3.0f; value = value...
constant uchar S7TABLE[0x80] = {0x1b, 0x32, 0x33, 0x5a, 0x3b, 0x10, 0x17, 0x54, 0x5b, 0x1a, 0x72, 0x73, 0x6b, 0x2c, 0x66, 0x49, 0x1f, 0x24, 0x13, 0x6c, 0x37, 0x2e, 0x3f, 0x4a, 0x5d, 0x0f, 0x40, 0x56, 0x25, 0x51, 0x1c, 0x04, 0x0b, 0x46, 0x20, 0x0d, 0x7b, 0x35, 0x44, 0x42, 0x2b, 0x1e, 0x41, 0x14, 0x4b, 0x79, 0x15, 0x6f, ...
kernel void bc_reverse(int num, global int* row_offsets, global int* column_indices, int start, global int* queue, global float* scores, global int* path_counts, global int* depths, int depth, global float* deltas) { int tid = get_global_id(0); int src; if (tid < num) { int src = queue[start + tid]; int r...
typedef float4 float4; kernel void orientation_assignment(global float4* keypoints, global float* grad, global float* ori, global int* counter, int octsize, float OriSigma, int nb_keypoints, int keypoints_start, int keypoints_end, int grad_width, int grad_height) { int lid0 = get_local_id(0); int groupid = get_grou...
kernel void EM_betaB_alphabeta(const int N, const int current, const int previous, global const float* beta, global const float* b, global const float* alpha, global float* betaB, global float* alpha_beta) { size_t idx = get_global_id(0); if (idx < N) { betaB[idx] = beta[previous + idx] * b[previous + idx]; ...
kernel void foo(global int* a, global char2* b) { *a = all(*b); }
unsigned int MurmurHash(const unsigned int value, const unsigned int seed) { const unsigned int c1 = 0xcc9e2d51; const unsigned int c2 = 0x1b873593; const unsigned int r1 = 15; const unsigned int r2 = 13; const unsigned int m = 5; const unsigned int n = 0xe6546b64; unsigned int hash = value; hash *= c1...
int pow_two(int exp) { return 1 << exp; } int powi(int base, int exp) { if (exp == 0) return 1; int ret = base; for (int i = 1; i < exp; i++) { ret *= base; } return ret; } kernel void finalizeExtended(global int* B, global int* D, global int* E) { int globId = get_global_id(0); int grpId = ge...
kernel void mad_hi_short16short16short16(global short16* src_0, global short16* src_1, global short16* src_2, global short16* dst) { int gid = get_global_id(0); dst[gid] = mad_hi(src_0[gid], src_1[gid], src_2[gid]); }
kernel void test_stream_read_float(global float* dst) { dst[0] = (float)3.40282346638528860e+38; }
void compute_flux_contribution(private float* density, private float3* momentum, private float* density_energy, float pressure, private float3* velocity, private float3* fc_momentum_x, private float3* fc_momentum_y, private float3* fc_momentum_z, private float3* fc_density_energy) { (*fc_momentum_x).x = (*velocity).x...
kernel void neq(global int* out, uchar a, uchar b) { out[0] = a != b; }
kernel void bc_normalize(int m, global float* scores, float max_score) { int tid = get_global_id(0); if (tid < m) scores[tid] = scores[tid] / max_score; }
kernel void brahmaKernel(global int* buf) { for (int i = 1; (i <= 2); i++) { int i0 = 2; buf[1] = i0; }; }
kernel void compiler_degrees(global float* src, global float* dst) { int i = get_global_id(0); dst[i] = degrees(src[i]); }
kernel void cl_contrast_curve(global const float2* in, global float2* out, global float* curve, int num_sampling_points) { int gid = get_global_id(0); float2 in_v = in[gid]; int x = in_v.x * num_sampling_points; float y; if (x < 0) y = curve[0]; else if (x < num_sampling_points) y = curve[x]; els...
kernel void kernelULong(global ulong* input, global ulong* output, unsigned int count) { unsigned int i = get_global_id(0); if (i < count) output[i] = input[i]; }
unsigned char logconv(unsigned char in) { return 25 * log((float)in + 1); } kernel void render(global char* input, global char* output, int width, int height) { unsigned int i = get_global_id(0); unsigned int i_mul_4 = i * 4; output[i_mul_4] = logconv(input[i_mul_4]); output[i_mul_4 + 1] = logconv(input[i_...
kernel void splitPC8D_octomap(global float8* pc8d, global float* pc3d, global uchar* rgb) { unsigned int gX = get_global_id(0); float8 point = pc8d[gX]; vstore3(point.s012 * 0.001f, gX, pc3d); vstore3(convert_uchar3(point.s456 * 255.f), gX, rgb); }
kernel void unary_minus_uint(global unsigned int* src_0, global unsigned int* dst) { int gid = get_global_id(0); dst[gid] = -src_0[gid]; }
kernel void add_numbers(global float* a, float b) { float c = a[0] + b; }
kernel void testSRem(int2 a, int2 b, global int2* res) { res[0] = a % b; }
kernel void post_increment_int2(global int2* src_0, global int2* dst) { int gid = get_global_id(0); dst[gid] = src_0[gid]++; }
kernel void ParallelBitonic_A(global const unsigned int* restrict in, global unsigned int* restrict out, int inc, int dir) { int i = get_global_id(0); int j = i ^ inc; unsigned int iData = in[i]; unsigned int iKey = iData; unsigned int jData = in[j]; unsigned int jKey = jData; bool smaller = (jKey < iKe...
; ; ; kernel void builtin_convert_int_to_char_sat(global int* src, global char* dst) { int i = get_global_id(0); dst[i] = convert_char_sat(src[i]); }
kernel void square(global float* input, global float* output) { size_t i = get_global_id(0); output[i] = input[i] * input[i]; }
kernel void builtin_lgamma_r(global float* src, global float* dst, global int* signp) { int i = get_global_id(0); dst[i] = lgamma_r(src[i], signp + i); }
kernel void bluestein_pre(global float2* input, global float2* A, global float2* B, unsigned int size, unsigned int ext_size) { unsigned int glb_id = get_global_id(0); unsigned int glb_sz = get_global_size(0); unsigned int double_size = size << 1; float sn_a, cs_a; const float NUM_PI = 3.1415926535897932384...
kernel void array_sum_f32(global float* a, global float* b, ulong rows, ulong cols, ulong axis) { ulong i = get_global_id(0); b[i] = 0.0; if (axis == 0) { for (ulong m = 0; m < rows; m++) { b[i] += a[m * cols + i]; } } else if (axis == 1) { for (ulong m = 0; m < cols; m++) { b[i] += a[...