summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony LaTorre <devnull@localhost>2012-12-21 11:51:35 -0500
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:39 -0700
commit1243752f8790ef7c34f1013c6504629138f6689d (patch)
treeecad3691ffd7942ad0f466a24c77323a10297449
parentbbb04c9aa4d2847e0b78a48424e37a962ee055a6 (diff)
downloadchroma-1243752f8790ef7c34f1013c6504629138f6689d.tar.gz
chroma-1243752f8790ef7c34f1013c6504629138f6689d.tar.bz2
chroma-1243752f8790ef7c34f1013c6504629138f6689d.zip
add abs() function for float3s
-rw-r--r--chroma/cuda/linalg.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/chroma/cuda/linalg.h b/chroma/cuda/linalg.h
index 35b2423..6317576 100644
--- a/chroma/cuda/linalg.h
+++ b/chroma/cuda/linalg.h
@@ -155,6 +155,12 @@ cross(const float3 &a, const float3 &b)
return make_float3(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x);
}
+__device__ float3
+abs(const float3&a)
+{
+ return make_float3(abs(a.x),abs(a.y),abs(a.z));
+}
+
__device__ float
norm(const float3 &a)
{