MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / sub

Function sub

FHE/Ring_Element.cpp:125–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125void sub(Ring_Element& ans,const Ring_Element& a,const Ring_Element& b)
126{
127 assert(a.FFTD);
128 if (a.rep!=b.rep) { throw rep_mismatch(); }
129 if (a.FFTD!=b.FFTD) { throw pr_mismatch(); }
130 if (a.element.empty())
131 {
132 ans = b;
133 ans.negate();
134 return;
135 }
136 else if (b.element.empty())
137 {
138 ans = a;
139 return;
140 }
141
142 if (&ans == &a)
143 {
144 ans -= b;
145 return;
146 }
147 else if (&ans == &b)
148 {
149 ans.negate();
150 ans += a;
151 return;
152 }
153
154 ans.prepare(a);
155 for (int i=0; i<(*ans.FFTD).phi_m(); i++)
156 ans.element.push_back(a.element[i].sub(b.element[i], a.FFTD->get_prD()));
157}
158
159
160

Callers

nothing calls this directly

Calls 8

rep_mismatchClass · 0.85
pr_mismatchClass · 0.85
emptyMethod · 0.45
negateMethod · 0.45
prepareMethod · 0.45
phi_mMethod · 0.45
push_backMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected