LENGTH(3clc)

πŸ“¦
version 1.0~svn33624 Β· 3 versions
, in ubuntu jammy, ubuntu noble

πŸ’– 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. 🫢
  • floatn is float, float2, float3, or float4 β€” and doublen is double, double2, double3, or double4. 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) or fma(3clc). fancy. obsessed.
  • If extended with cl_khr_fp16(3clc), generic type name gentype may indicate half and half{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 πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

The Khronos Group β€” kings, honestly. main character energy.


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) πŸ“

  1. 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