Skip to content

Fixed errors in Vector.random when generating floating-point vectors or vectors with repeated elements.#141

Merged
Mr-Python-in-China merged 2 commits intoluogu-dev:masterfrom
weilycoder:dev2
Oct 5, 2024
Merged

Fixed errors in Vector.random when generating floating-point vectors or vectors with repeated elements.#141
Mr-Python-in-China merged 2 commits intoluogu-dev:masterfrom
weilycoder:dev2

Conversation

@weilycoder
Copy link
Contributor

@weilycoder weilycoder commented Oct 5, 2024

#140

没写 Test 导致的,但是好像也不太好写。

EDITED: 加入了 vector_test

@weilycoder
Copy link
Contributor Author

另外,可以将 unique 部分的代码简单写成:

[tuple(map(lambda x, y: x + y, Vector.get_vector(dimension, length, x), offset)) for x in random.sample(range(vector_space), k=num)]

可以优化时空间效率。

暂时未作修改。

@Mr-Python-in-China
Copy link
Collaborator

我草前一版谁写的
出列

@Mr-Python-in-China Mr-Python-in-China merged commit 3b8fba8 into luogu-dev:master Oct 5, 2024
@weilycoder weilycoder deleted the dev2 branch October 5, 2024 05:35
@Mr-Python-in-China Mr-Python-in-China linked an issue Oct 19, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

貌似是一个 bug?

2 participants