mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-12 02:13:36 +00:00
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2698 Add headers about copyright. Reviewed By: algoriddle Differential Revision: D43085637 fbshipit-source-id: 5a57876b7047097ffe01cd79322674625d9bca34
38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <faiss/utils/simdlib.h>
|
|
|
|
using namespace faiss;
|
|
|
|
TEST(TEST_SIMDLIB, TestCmpltAndBlendInplace) {
|
|
simd8float32 lowestValues(0, 1, 2, 3, 4, 5, 6, 7);
|
|
simd8uint32 lowestIndices(0, 1, 2, 3, 4, 5, 6, 7);
|
|
|
|
simd8float32 candidateValues0(5, 5, 5, 5, 5, 5, 5, 5);
|
|
simd8uint32 candidateIndices0(10, 11, 12, 13, 14, 15, 16, 17);
|
|
cmplt_and_blend_inplace(
|
|
candidateValues0, candidateIndices0, lowestValues, lowestIndices);
|
|
|
|
simd8float32 candidateValues1(6, 6, 6, 6, 6, 6, 6, 6);
|
|
simd8uint32 candidateIndices1(20, 21, 22, 23, 24, 25, 26, 27);
|
|
cmplt_and_blend_inplace(
|
|
candidateValues1, candidateIndices1, lowestValues, lowestIndices);
|
|
|
|
simd8float32 candidateValues2(0, 1, 2, 3, 4, 5, 5, 5);
|
|
simd8uint32 candidateIndices2(30, 31, 32, 33, 34, 35, 36, 37);
|
|
cmplt_and_blend_inplace(
|
|
candidateValues2, candidateIndices2, lowestValues, lowestIndices);
|
|
|
|
simd8float32 expectedValues(0, 1, 2, 3, 4, 5, 5, 5);
|
|
simd8uint32 expectedIndices(0, 1, 2, 3, 4, 5, 16, 17);
|
|
ASSERT_EQ(lowestValues, expectedValues);
|
|
ASSERT_EQ(lowestIndices, expectedIndices);
|
|
}
|