Skip to content

Latest commit

 

History

History
947 lines (815 loc) · 22.5 KB

builtin_function.md

File metadata and controls

947 lines (815 loc) · 22.5 KB

Built-in Functions

Builtin C Functions

Format

abs(x)

Supported Parameter Types:

  • i32 i64 f32 f64
  • simd_vector<i32> simd_vector<i64> simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<int64_t, int64_t>("abs(x)", {"x"});

Format

max(x,y)

Supported Parameter Types:

  • i8 i16 i32 i64 u8 u16 u32 u64 f32 f64
  • simd_vector<i8> simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<f32> simd_vector<f64>
  • simd_vector<u8> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Throws

  • throw rapidudf::SizeMismatchException when size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<int64_t, int64_t>("max(x,y)", {"x", "y"});

Format

min(x,y)

Supported Parameter Types:

  • i8 i16 i32 i64 u8 u16 u32 u64 f32 f64
  • simd_vector<i8> simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<f32> simd_vector<f64>
  • simd_vector<u8> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Throws

  • throw rapidudf::SizeMismatchException when size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<int64_t, int64_t>("min(x,y)", {"x", "y"});

Format

pow(x,y)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Throws

  • throw rapidudf::SizeMismatchException when size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("pow(x,y)", {"x", "y"});

Format

ceil(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("ceil(x)", {"x"});

Format

floor(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("floor(x)", {"x"});

Format

round(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("round(x)", {"x"});

Format

rint(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("rint(x)", {"x"});

Format

trunc(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("trunc(x)", {"x"});

Format

erf(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("erf(x)", {"x"});

Format

erfc(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("erfc(x)", {"x"});

Format

exp(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("exp(x)", {"x"});

Format

expm1(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("expm1(x)", {"x"});

Format

exp2(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("exp2(x)", {"x"});

Format

sqrt(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("sqrt(x)", {"x"});

Format

log(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("log(x)", {"x"});

Format

log2(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("log2(x)", {"x"});

Format

log10(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("log10(x)", {"x"});

Format

log1p(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("log1p(x)", {"x"});

Format

sin(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("sin(x)", {"x"});

Format

cos(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("cos(x)", {"x"});

Format

tan(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("tan(x)", {"x"});

Format

asin(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("asin(x)", {"x"});

Format

acos(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("acos(x)", {"x"});

Format

atan(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("atan(x)", {"x"});

Format

sinh(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("sinh(x)", {"x"});

Format

cosh(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("cosh(x)", {"x"});

Format

tanh(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("tanh(x)", {"x"});

Format

asinh(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("asinh(x)", {"x"});

Format

acosh(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("acosh(x)", {"x"});

Format

atanh(x)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float>("atanh(x)", {"x"});

Format

atan2(x,y)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Throws

  • throw rapidudf::SizeMismatchException when size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("atan2(x,y)", {"x", "y"});

Format

hypot(x,y)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Throws

  • throw rapidudf::SizeMismatchException when size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("hypot(x,y)", {"x", "y"});

sum

Format

sum(x)

Return Value

Returns the sum of all

Supported Parameter Types:

  • simd_vector<i8> simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<f32> simd_vector<f64>
  • simd_vector<u8> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, simd::Vector<float>>("sum(x)", {"x"});

dot

Format

dot(x,y )

Return Value

Returns sum{x[i] * y[i]} for floating-point inputs

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>

Throws

  • throw rapidudf::SizeMismatchException when vector size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, simd::Vector<float>,simd::Vector<float>>("dot(x,y)", {"x", "y"});

iota

Format

iota(Start, N)

Return Value

Returns vector with size N where the index i has the given value of Start+i

Supported Parameter Types:

  • simd_vector<i8> simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<f32> simd_vector<f64>
  • simd_vector<u8> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<simd::Vector<uint32_t>>("iota(1_u32,100)", {});

Format

clamp(x,y,z)

Supported Parameter Types:

  • i8 i16 i32 i64 u8 u16 u32 u64 f32 f64
  • simd_vector<i8> simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<f32> simd_vector<f64>
  • simd_vector<u8> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Throws

  • throw rapidudf::SizeMismatchException when vector size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("clamp(x,y,z)", {"x", "y", "z"});

Format

fma(x,y,z)

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Throws

  • throw rapidudf::SizeMismatchException when vector size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("fma(x,y,z)", {"x", "y", "z"});

fms

Format

fms(a,b,c)

Return Value

a[i] * b[i] - c[i]

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Throws

  • throw rapidudf::SizeMismatchException when vector size mismatch

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("fms(x,y,z)", {"x", "y", "z"});

fnma

Format

fnma(a,b,c)

Return Value

-a[i] * b[i] + c[i]

Throws

  • throw rapidudf::SizeMismatchException when vector size mismatch

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("fnma(x,y,z)", {"x", "y", "z"});

fnms

Format

fnms(a,b,c)

Return Value

-a[i] * b[i] - c[i]

Throws

  • throw rapidudf::SizeMismatchException when vector size mismatch

Supported Parameter Types:

  • f32 f64
  • simd_vector<f32> simd_vector<f64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<float, float, float>("fnms(x,y,z)", {"x", "y", "z"});

sort

Format

sort(vec,descending)

Return Value

void

Throws

  • throw rapidudf::ReadonlyException when vector is readonly

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<void, simd::Vector<float>>("sort(x,true)", {"x"});

select

Format

select(vec,k, descending)

Return Value

void

Throws

  • throw rapidudf::ReadonlyException when vector is readonly

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<void, simd::Vector<float>>("select(x,5,true)", {"x"});

topk

Format

topk(vec,k, descending)

Return Value

void

Throws

  • throw rapidudf::ReadonlyException when vector is readonly

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<void, simd::Vector<float>>("topk(x,5,true)", {"x"});

argsort

Format

argsort(vec, descending)

Return Value

simd::Vector<uint64_t>

Throws

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<simd::Vector<uint64_t>, simd::Vector<float>>("argsort(x,true)", {"x"});

argselect

Format

argselect(vec, k, descending)

Return Value

simd::Vector<uint64_t>

Throws

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i16> simd_vector<i32> simd_vector<i64> simd_vector<u16> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<simd::Vector<uint64_t>, simd::Vector<float>>("argselect(x,3, true)", {"x"});

sort_kv

Format

sort_kv(key_vec,value_vec, descending)

Return Value

simd::Vector<uint64_t>

Throws

  • throw rapidudf::ReadonlyException when key/value vector is readonly

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i32> simd_vector<i64> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<void, simd::Vector<uint64_t>, simd::Vector<float>>("sort_kv(x,y, true)", {"x"});

select_kv

Format

select_kv(key_vec,value_vec,k,descending)

Return Value

simd::Vector<uint64_t>

Throws

  • throw rapidudf::ReadonlyException when key/value vector is readonly

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i32> simd_vector<i64> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<void, simd::Vector<uint64_t>, simd::Vector<float>>("select_kv(x,y,10,true)", {"x"});

topk_kv

Format

topk_kv(key_vec,value_vec,k,descending)

Return Value

simd::Vector<uint64_t>

Throws

  • throw rapidudf::ReadonlyException when key/value vector is readonly

Supported Parameter Types:

  • simd_vector<f32> simd_vector<f64>
  • simd_vector<i32> simd_vector<i64> simd_vector<u32> simd_vector<u64>

Examples

JitCompiler compiler;
auto result = compiler.CompileExpression<void, simd::Vector<uint64_t>, simd::Vector<float>>("topk_kv(x,y,10,true)", {"x"});

Builtin C++ Member Functions

StringView

  • .size() return container size
  • .contains(part) return true if part exist
  • .starts_with(part) return true if part starts_with
  • .ends_with(part) return true if part ends_with
  • .contains_ignore_case(part) return true if part contains_ignore_case
  • .starts_with_ignore_case(part) return true if part starts_with_ignore_case
  • .ends_with_ignore_case(part) return true if part ends_with_ignore_case

std::vector

  • .get(idx) get element by index
  • .size() return container size
  • .find(v) return element idx, return -1 if not found
  • .contains(v) return true if element exist

std::map/std::unordered_map

  • .get(key) get element by key, return default value if not exist
  • .size() return container size
  • .contains(key) return true if key exist

std::set/std::unordered_set

  • .size() return container size
  • .contains(key) return true if key exist

google::protobuf::RepeatedField

  • .get(idx) get element by index
  • .size() return container size
  • .find(v) return element idx, return -1 if not found
  • .contains(v) return true if element exist

google::protobuf::RepeatedPtrField

  • .get(idx) get element by index
  • .size() return container size

google::protobuf::Map

  • .get(key) get element by key, return default value if not exist
  • .size() return container size
  • .contains(key) return true if key exist

flatbuffers::Vector

  • .get(idx) get element by index
  • .size() return container size

Vector(rapidudf::simd::Vector)

  • .find(T v) return first position for given value, return -1 when failed
  • .find_neq(T v) return first value's position not equal given value, return -1 when failed
  • .find_gt(T v) return first value's position greater than given value, return -1 when failed
  • .find_ge(T v) return first value's position greater equal than given value, return -1 when failed
  • .find_lt(T v) return first value's position less than given value, return -1 when failed
  • .find_le(T v) return first value's position less equal than given value, return -1 when failed

Vector Table

  • .filter(simd::Vector<Bit>) return new table after filter
  • .order_by(simd::Vector<T> column, bool descending) return new table after order_by
  • .topk(simd::Vector<T> column, uint32_t k, bool descending) return new table after topk
  • .group_by(simd::Vector<T> column) return tables after group_by