MCPcopy Create free account
hub / github.com/conflow-dev/ConFlow / ecall_clip

Function ecall_clip

sgx_tf_ops/Enclave/Enclave.cpp:2351–2451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2349}
2350
2351void ecall_clip(float *input, float* down, float* up,int n1,int n2,int N,float *output){
2352 float *x = (float*)malloc(sizeof(float)*N);
2353 memset(x, 0, sizeof(float)*N);
2354 for(int j=0;j<N;j++){
2355 x[j] = 0.0f;
2356 float sum = input[insert*N+j];
2357 float c = 0.0f;
2358 for(int i=0;i<Nt;i++){
2359 float y = input[indexs[i]*N+j] - c;
2360 float t = sum + y;
2361 c = (t - sum) - y;
2362 sum = t;
2363 }
2364 x[j] = sum;
2365 }
2366
2367 float *down1 = (float*)malloc(sizeof(float)*n1);
2368 memset(down1, 0, sizeof(float)*n1);
2369 if(n1 == 1){
2370 down1[0] = down[0];
2371 }
2372 else{
2373 for(int j=0;j<n1;j++){
2374 down1[j] = 0.0f;
2375 float sum = down[insert*n1+j];
2376 float c = 0.0f;
2377 for(int i=0;i<Nt;i++){
2378 float y = down[indexs[i]*n1+j] - c;
2379 float t = sum + y;
2380 c = (t - sum) - y;
2381 sum = t;
2382 }
2383 down1[j] = sum;
2384 }
2385 }
2386
2387 float *up1 = (float*)malloc(sizeof(float)*n2);
2388 memset(up1, 0, sizeof(float)*n2);
2389 if(n2 == 1){
2390 up1[0] = up[0];
2391 }
2392 else{
2393 for(int j=0;j<N;j++){
2394 up1[j] = 0.0f;
2395 float sum = up[insert*N+j];
2396 float c = 0.0f;
2397 for(int i=0;i<Nt;i++){
2398 float y = up[indexs[i]*N+j] - c;
2399 float t = sum + y;
2400 c = (t - sum) - y;
2401 sum = t;
2402 }
2403 up1[j] = sum;
2404 }
2405 }
2406 for (int j = 0; j < N; j++) {
2407 if(x[j]-down1[j%n1] < -1e-7f){
2408 x[j] = down1[j%n1];

Callers 1

clipFunction · 0.85

Calls 1

gaussrandFunction · 0.85

Tested by

no test coverage detected