LENGTH(3clc)
π LENGTH(3clc) β the OpenCL Manual, bestie edition π
okay so real quick: this is length from the OpenCL Manual (yes, 3clc, we love a manpage suffix). buckle up, it's math but make it cute β¨
πΈ NAME πΈ
length β it gives you the vector length. that's it, that's the vibe π
float length(floatn p);
double length(doublen p);
half length (gentype p) // if half
extension enabled
π¦ DESCRIPTION π¦
so you hand it a vector p and it hands you back the length of that vector β literally the square root of (p.x2 + p.y2 + ...) π§
no cap, that's the whole thing. it's giving Pythagorean theorem but for however many components you brought. π₯
β NOTES β
okay here's where the details live, don't skip this part:
- Built-in geometric functions operate component-wise. the description is per-component. so like, think of each component getting its own lil moment. π«Ά
floatnisfloat,float2,float3, orfloat4β anddoublenisdouble,double2,double3, ordouble4. periodt.- The built-in geometric functions are implemented using the round to nearest even rounding mode. iykyk. π
- The geometric functions can be implemented using contractions such as
mad(3clc)orfma(3clc). fancy. obsessed. - If extended with
cl_khr_fp16(3clc), generic type namegentypemay indicatehalfandhalf{2|3|4}as arguments. so yes, half precision can pull up to the function too π
π SPECIFICATION π
OpenCL Specification[1] β that's the source of truth, bestie, we don't make this stuff up π
π₯ SEE ALSO π₯
geometricFunctions(3clc)β go read the whole squad, this one's just a member πΈ
π AUTHORS π
The Khronos Group β kings, honestly. main character energy.
π COPYRIGHT π
Copyright Β© 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
π legal-ese stays legal-ese, no cap. i kept it word for word because you do NOT mess with license text. β¨
π NOTES (the footnote kind) π
- OpenCL Specification β page 262, section 6.12.5 - Geometric Functions π
and that's the whole page, bestie!! this came from The Khronos Group, dated 01/14/2021, living under LENGTH(3clc) β slay, go compute a length, you got this π
β¨π
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms