CUDAClamp[lst]
clamps the values of lst between automatically determined values.
CUDAClamp[lst,low,high]
clamps the values of lst between low and high.
CUDAClamp
CUDAClamp[lst]
clamps the values of lst between automatically determined values.
CUDAClamp[lst,low,high]
clamps the values of lst between low and high.
Details and Options
- The CUDALink application must be loaded using Needs["CUDALink`"].
- CUDAClamp works only on general types such as "Float", "Double", ….
- CUDAClamp does not work on fixed vector structure types like "Float[2]", "Integer32[2]", ….
- CUDAClamp does not work on symbolic input.
- If low and high are not specified, then low is 0.0 and high is 1.0 if the input is floating point. If the input is integers, then low is 0 and high is 255.
Examples
open all close allBasic Examples (5)
First, load the CUDALink application:
Needs["CUDALink`"]This clamps the values of an integer list:
CUDAClamp[Table[i, {i, 0, 500}, {j, 0, 500}]]//ArrayPlotThe above is equivalent to Map:
Map[Cos, 1.0 * Range[10]]The clamp values can be made explicit:
CUDAClamp[Table[i, {i, 0, 500}, {j, 0, 500}], 0, 100]//ArrayPlotThe input can be floating point:
CUDAClamp[GaussianMatrix[ {20, 20}], 0.0, 0.0004]//ListPlot3DThe input can be an image, which is interpreted as a list of integers:
CUDAClamp[[image], 75, 255]The high clamp parameter can be omitted:
CUDAClamp[[image], 75]The input can be CUDAMemory. This loads a list using CUDAMemoryLoad:
mem = CUDAMemoryLoad[Range[-10, 10], "Byte"]This clamps the values between -5 and 5:
res = CUDAClamp[mem, -5, 5]The memory returned can be retrieved using CUDAMemoryGet:
CUDAMemoryGet[res]Applications (1)
CUDAClamp can be used to process geographic elevation data. This loads the data from the Wolfram servers:
gisData = Import[ "http://exampledata.wolfram.com/sdtsdem.tar.gz", "Data" ];This clamps the values of the elevation data:
Manipulate[ReliefPlot[CUDAClamp[gisData, low, high], ColorFunction -> "GreenBrownTerrain"], {low, Min[gisData], Max[gisData] / 2}, {high, Max[gisData] / 2, Max[gisData]}]Interactive Examples (2)
This allows the user to interactively change the clamp values:
Manipulate[ArrayPlot[CUDAClamp[Table[i, {i, 0, kk}, {j, 0, kk}]]], {kk, 1, 1000}]The same can be applied for datasets:
lst = GaussianMatrix[ {50, 50}];
Manipulate[ListPlot3D[CUDAClamp[lst, 0.0, ii]], {ii, Min[lst], Max[lst]}]Tech Notes
Related Guides
-
▪
- CUDALink
Text
Wolfram Research (2010), CUDAClamp, Wolfram Language function, https://reference.wolfram.com/language/CUDALink/ref/CUDAClamp.html.
CMS
Wolfram Language. 2010. "CUDAClamp." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/CUDALink/ref/CUDAClamp.html.
APA
Wolfram Language. (2010). CUDAClamp. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/CUDALink/ref/CUDAClamp.html
BibTeX
@misc{reference.wolfram_2026_cudaclamp, author="Wolfram Research", title="{CUDAClamp}", year="2010", howpublished="\url{https://reference.wolfram.com/language/CUDALink/ref/CUDAClamp.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_cudaclamp, organization={Wolfram Research}, title={CUDAClamp}, year={2010}, url={https://reference.wolfram.com/language/CUDALink/ref/CUDAClamp.html}, note=[Accessed: 13-June-2026]}