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

Function ecall_where_equal_grad

sgx_tf_ops/Enclave/Enclave.cpp:5621–5787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5619}
5620
5621void ecall_where_equal_grad(float* grad,float *input1,float *input2,float *cond1,float *cond2,int N,int n1,int n2,float *output1,float* output2){
5622 float *x1 = (float*)malloc(sizeof(float)*N);
5623 memset(x1, 0, sizeof(float)*N);
5624 for(int j=0;j<N;j++){
5625 x1[j] = 0.0f;
5626 float sum = input1[insert*N+j];
5627 float c = 0.0f;
5628 for(int i=0;i<Nt;i++){
5629 float y = input1[indexs[i]*N+j] - c;
5630 float t = sum + y;
5631 c = (t - sum) - y;
5632 sum = t;
5633 }
5634 x1[j] = sum;
5635 }
5636 float *x2 = (float*)malloc(sizeof(float)*N);
5637 memset(x2, 0, sizeof(float)*N);
5638 for(int j=0;j<N;j++){
5639 x2[j] = 0.0f;
5640 float sum = input2[insert*N+j];
5641 float c = 0.0f;
5642 for(int i=0;i<Nt;i++){
5643 float y = input2[indexs[i]*N+j] - c;
5644 float t = sum + y;
5645 c = (t - sum) - y;
5646 sum = t;
5647 }
5648 x2[j] = sum;
5649 }
5650 float *x3 = (float*)malloc(sizeof(float)*n1);
5651 memset(x3, 0, sizeof(float)*n1);
5652 if(n1 == 1){
5653 x3[0] = cond1[0];
5654 }
5655 else{
5656 for(int j=0;j<n1;j++){
5657 x3[j] = 0.0f;
5658 float sum = cond1[insert*n1+j];
5659 float c = 0.0f;
5660 for(int i=0;i<Nt;i++){
5661 float y = cond1[indexs[i]*n1+j] - c;
5662 float t = sum + y;
5663 c = (t - sum) - y;
5664 sum = t;
5665 }
5666 x3[j] = sum;
5667 }
5668 }
5669
5670 float *x4 = (float*)malloc(sizeof(float)*n2);
5671 memset(x4, 0, sizeof(float)*n2);
5672 if(n2 == 1){
5673 x4[0] = cond2[0];
5674 }
5675 else{
5676 for(int j=0;j<n2;j++){
5677 x4[j] = 0.0f;
5678 float sum = cond2[insert*n2+j];

Callers 1

where_equal_gradFunction · 0.85

Calls 1

gaussrandFunction · 0.85

Tested by

no test coverage detected