ClickHouse/tests/queries/0_stateless/02011_tuple_vector_functions.sql

59 lines
1.8 KiB
MySQL
Raw Normal View History

SELECT tupleHammingDistance(tuple(1), tuple(1));
2021-08-27 17:05:33 +00:00
SELECT tupleHammingDistance((1, 3), (1, 2));
2021-08-27 17:05:33 +00:00
SELECT (1, 2) + tupleMultiply((3, 4), (5, 1)) - (6, 3);
SELECT vectorDifference(tuplePlus((1, 2), (3, 4)), (5, 6));
SELECT tupleMinus(vectorSum(tupleMultiply((1, 2), (3, 4)), (5, 6)), (31, 41));
SELECT tupleDivide((5, 8, 11), (-2, 2, 4));
SELECT tuple(1) + tuple(2);
2021-08-23 13:41:20 +00:00
2021-08-27 17:05:33 +00:00
SELECT tupleNegate((1, 0, 3.5));
2021-08-30 17:13:41 +00:00
SELECT -(1, 2, 3);
SELECT -tuple(1);
2021-08-25 14:02:04 +00:00
2021-08-27 17:05:33 +00:00
SELECT tupleMultiplyByNumber((1, 2, 3), 0.5);
SELECT tupleDivideByNumber((1, 2.5, 3), 0.5);
2021-08-27 15:44:04 +00:00
SELECT tupleMultiplyByNumber(tuple(1), 1);
SELECT tupleDivideByNumber(tuple(1), 1);
2021-08-30 16:10:27 +00:00
SELECT (1, 2.0, 3.1) * 3;
SELECT 5.5 * (2, 4);
SELECT (1, 2) / 2;
SELECT 2 / (1, 1); -- { serverError 43 }
2021-08-27 17:05:33 +00:00
SELECT tuple(1, 2, 3) * tuple(2, 3, 4);
SELECT dotProduct((-1, 2, 3.002), (2, 3.4, 4));
SELECT scalarProduct(tuple(1), tuple(0));
2021-08-25 14:56:31 +00:00
2021-08-27 17:05:33 +00:00
SELECT L1Norm((-1, 2, -3));
SELECT L1Norm((-1, 2.5, -3.6));
2021-08-30 12:52:00 +00:00
SELECT L2Norm((1, 1.0));
SELECT L2Norm((-12, 5));
2021-08-26 12:34:46 +00:00
SELECT max2(1, 1.5);
SELECT min2(-1, -3);
2021-08-27 17:05:33 +00:00
SELECT LinfNorm((1, -2.3, 1.7));
2021-08-26 18:17:44 +00:00
SELECT LpNorm(tuple(-1), 3);
SELECT LpNorm(tuple(-1.1), 3);
2021-08-27 17:05:33 +00:00
SELECT LpNorm((95800, 217519, 414560), 4);
SELECT LpNorm((13, -84.4, 91, 63.1), 2) = L2Norm(tuple(13, -84.4, 91, 63.1));
SELECT LpNorm((13, -84.4, 91, 63.1), 1) = L1Norm(tuple(13, -84.4, 91, 63.1));
SELECT LpNorm((-1, -2), 11);
SELECT L1Distance((1, 2, 3), (2, 3, 1));
SELECT L2Distance((1, 1), (3, -1));
SELECT LinfDistance((1, 1), (1, 2));
SELECT L2Distance((5, 5), (5, 5));
2021-08-30 12:52:00 +00:00
SELECT LpDistance((1800, 1900), (18, 59), 12) - LpDistance(tuple(-22), tuple(1900), 12);
SELECT L1Normalize((1, -4));
SELECT L2Normalize((3, 4));
SELECT LinfNormalize((5, -5, 5.0));
2021-08-30 14:31:37 +00:00
SELECT LpNormalize((1, pow(31, 1 / 5)), 5);
SELECT cosineDistance((1, 1), (2, 2));
SELECT cosineDistance((1, 1), (-3, 3.0));
SELECT cosineDistance((1, 1), (-1, -1));
SELECT cosineDistance((1, 0), (0.5, sqrt(3) / 2));