Comments (7)
(1)
You are right! I think it is a mistake.
Since there are no unit tests for all xxxInplace
functions currently, this part of the code may also contain other errors. We will complete the unit tests as soon as possible.
(2)
Because std::vector is not a real vector type. It is a proxy type. It's somewhat similar to a bitset so that you can't get the address of each bit.
See:
https://stackoverflow.com/questions/17794569/why-isnt-vectorbool-a-stl-container
abseil/abseil-cpp#644
https://en.cppreference.com/w/cpp/container/vector_bool
from yacl.
@usafchn ,
(3) I also doubt that in arg_kv.h,
template <typename T>
SpiArg operator=(const T &value) {
value_ = value;
return *this;
}
Should it be &SpiArg operator=(const T &value) {
?
(4) In mpint_field.h, can void NegInplace(MPInt *x) const override;
cover class GaloisField
's virtual void NegInplace(Item* x) const = 0;
? The main problem is the conversion between MPInt*
and Item*
.
from yacl.
@usafchn , (3) I also doubt that in arg_kv.h,
template <typename T> SpiArg operator=(const T &value) { value_ = value; return *this; }
Should it be
&SpiArg operator=(const T &value) {
? (4) In mpint_field.h, canvoid NegInplace(MPInt *x) const override;
coverclass GaloisField
'svirtual void NegInplace(Item* x) const = 0;
? The main problem is the conversion betweenMPInt*
andItem*
.
首先,本 pr 前面提到的一些问题连同 mpint 其它的一些 bugfix 将在下一次 sync 的时候同步 github,我就不直接在 github 上改了。
(3) 是一个很好的建议,我改成返回引用
(4) 应该不涉及类型强转。这里的继承关系是 MPIntField -> GFScalarSketch -> GaloisField, GFScalarSketch<MPInt>
会把所有 Item 转换成实际类型,本质上,GFScalarSketch<MPInt>
实现了 GaloisField 中所有的虚函数 同时自己又定义了一组同名的新的虚函数,只是参数不一样,MPIntField 实现的是 GFScalarSketch<MPInt>
定义的虚函数,没有直接实现 GaloisField 中的函数。
关于第三代 SPI 架构设计,目前还没有公开,后面我整理一下放到官网文档中,大意就是:
from yacl.
对于GaloisField的SPI,类似GaloisFieldFactory::Instance().Create(kFieldName, ArgLib = kLibName,ArgMod = 13_mp)
得到的unique_ptr<GaloisField> p
将很难调用MPIntField::NegInplace(MPInt *x)
,因为中间隔了一层GFScalarSketch. 似乎要对指针做类型转换才能调用MPIntField::NegInplace(MPInt *x)
.
from yacl.
对于GaloisField的SPI,类似
GaloisFieldFactory::Instance().Create(kFieldName, ArgLib = kLibName,ArgMod = 13_mp)
得到的unique_ptr<GaloisField> p
将很难调用MPIntField::NegInplace(MPInt *x)
,因为中间隔了一层GFScalarSketch. 似乎要对指针做类型转换才能调用MPIntField::NegInplace(MPInt *x)
.
对于 p->NegInplace(Item *)
这个例子,Item 表示 GaloisField 中的一个 Element,不一定就是 MPInt。至于 Item 的实际类型,是 Lib 自己定义的类型,可以是任意类型,对用户完全是黑盒。
虽然对于 MPInt Field, 其类型已知是 MPInt,但是对于别的 GaloisField,比如扩域,二进制域(Binary Field),甚至多项式域,其类型根本不是 MPInt,域底层的集合也不一定定义在整数
auto gf = GaloisFieldFactory::Instance().Create(kFieldName, ArgMod = 13_mp);
// use gf
// gf->XXXX()
GaloisFieldFactory 将自动选定最合适的 Lib。
至于用户怎么创建 Item,需要一个从“共识”类型 Map 到 Field Element,即 Encoders 或 Converters,Encoder/Converter 接口会随着 Lib 的增加逐步完善。
另外 GaloisField
中出现了 MPInt,比如 virtual MPInt GetOrder() const = 0
,这是因为 MPInt 本身是 YACL 的基础设施之一,是一个“共识”类型,无论哪种 GaloisField 这个接口一定返回整数类型。
from yacl.
(^_^),我不知道下一次Repo Sync会修改哪些内容。我先在PR里面改了mpint_field和arg_kv等文件。
from yacl.
(^_^),我不知道下一次Repo Sync会修改哪些内容。我先在PR里面改了mpint_field和arg_kv等文件。
好的,已经合入,感谢!~
from yacl.
Related Issues (20)
- Improve OT Store data structure in `yacl/crypto/kernel/type/ot_store.h`
- Feat: Add F2k VOLE support HOT 1
- Feat: Allow saving/reading cuckoo hashing table to/from a csv file
- Problems in ferret_ote HOT 9
- A small problem in gadget HOT 5
- [Bug]: gcc13 编译时,会报一些数据类型未定义 HOT 5
- Problems in kkrt_ote HOT 3
- Problem in softspoken_ote HOT 5
- 在 YACL 中实现 Kyber OT 协议 HOT 2
- WSL-Ubuntu20.04编译Yacl(bazel build //... -c dbg)报错: HOT 2
- A problem in yacl/kernels/svole_kernel.cc HOT 1
- Problem in yacl/crypto/ossl-provider/helper.h HOT 2
- 建议:ContextDescProto的repeated PartyProto parties排序处理 HOT 1
- yacl/crypto/tpre/kdf的问题 HOT 2
- Windows x86_64 platform support HOT 2
- 编译问题 HOT 24
- 编译问题报错 ld.lld: error: undefined symbol: dlopen HOT 7
- [Question]: Pack before comparison HOT 1
- Problem in Sm4Drbg HOT 3
- 关于yacl编译后的安装问题。
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yacl.