Linear algebra functions for the CUDA version of PyPO. More...
#include <math.h>#include <cuda.h>#include <cuComplex.h>Go to the source code of this file.
Functions | |
| __device__ __inline__ void | dot (float(&v1)[3], float(&v2)[3], float &out) |
| __device__ __inline__ void | dot (cuFloatComplex(&cv1)[3], cuFloatComplex(&cv2)[3], cuFloatComplex &out) |
| __device__ __inline__ void | dot (cuFloatComplex(&cv1)[3], float(&v2)[3], cuFloatComplex &out) |
| __device__ __inline__ void | dot (float(&v1)[3], cuFloatComplex(&cv2)[3], cuFloatComplex &out) |
| __device__ __inline__ void | ext (float(&v1)[3], float(&v2)[3], float(&out)[3]) |
| __device__ __inline__ void | ext (cuFloatComplex(&cv1)[3], cuFloatComplex(&cv2)[3], cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | ext (cuFloatComplex(&cv1)[3], float(&v2)[3], cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | ext (float(&v1)[3], cuFloatComplex(&cv2)[3], cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | diff (float(&v1)[3], float(&v2)[3], float(&out)[3]) |
| __device__ __inline__ void | diff (cuFloatComplex(&cv1)[3], cuFloatComplex(&cv2)[3], cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | abs (float(&v)[3], float &out) |
| __device__ __inline__ void | conja (cuFloatComplex(&cv)[3], cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | normalize (float(&v)[3], float(&out)[3]) |
| __device__ __inline__ void | add (float(&v1)[3], float(&v2)[3], float(&out)[3]) |
| __device__ __inline__ void | s_mult (float(&v)[3], float &s, float(&out)[3]) |
| __device__ __inline__ void | s_mult (cuFloatComplex(&cv)[3], cuFloatComplex &cs, cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | s_mult (float(&v)[3], cuFloatComplex &cs, cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | s_mult (cuFloatComplex(&cv)[3], const float &s, cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | snell (cuFloatComplex(&cvin)[3], float(&normal)[3], cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | snell (float(&vin)[3], float(&normal)[3], float(&out)[3]) |
| __device__ __inline__ void | snell_t (float(&vin)[3], float(&normal)[3], float mu, float(&out)[3]) |
| __device__ __inline__ void | dyad (float(&v1)[3], float(&v2)[3], float(&out)[3][3]) |
| __device__ __inline__ void | matDiff (float(&m1)[3][3], float(&m2)[3][3], float(&out)[3][3]) |
| __device__ __inline__ void | matVec (float(&m1)[3][3], float(&v1)[3], float(&out)[3]) |
| __device__ __inline__ void | matVec (float(&m1)[3][3], cuFloatComplex(&cv1)[3], cuFloatComplex(&out)[3]) |
| __device__ __inline__ void | matVec4 (float(&mat)[16], float(&cv1)[3], float(&out)[3], bool vec=false) |
| __device__ __inline__ void | invmatVec4 (float(&mat)[16], float(&cv1)[3], float(&out)[3], bool vec=false) |
| __device__ __inline__ cuFloatComplex | cuCexpf (cuFloatComplex z) |
| __device__ __inline__ cuFloatComplex | cuCaddSf (cuFloatComplex a, float b) |
| __device__ __inline__ cuFloatComplex | cuCaddSf (float a, cuFloatComplex b) |
| __device__ __inline__ cuFloatComplex | cuCsubSf (cuFloatComplex a, float b) |
| __device__ __inline__ cuFloatComplex | cuCsubSf (float a, cuFloatComplex b) |
| __device__ __inline__ cuFloatComplex | cuCmulSf (cuFloatComplex a, float b) |
| __device__ __inline__ cuFloatComplex | cuCmulSf (float a, cuFloatComplex b) |
| __device__ __inline__ cuFloatComplex | cuCdivSf (cuFloatComplex a, float b) |
| __device__ __inline__ cuFloatComplex | cuCdivSf (float a, cuFloatComplex b) |
Linear algebra functions for the CUDA version of PyPO.
Contains float overloaded functions for doing basic 3D vector operations. For the CUDA complex valued linear algebra, we employ the cuComplex.h library.
| __device__ __inline__ void abs | ( | float(&) | v[3], |
| float & | out | ||
| ) |
Absolute value.
Calculate absolute value of real valued vector of size 3.
| v | Array of 3 float. |
| out | Scalar float. |
| __device__ __inline__ void add | ( | float(&) | v1[3], |
| float(&) | v2[3], | ||
| float(&) | out[3] | ||
| ) |
Vector addition.
Add two real valued vectors of size 3 element-wise.
| v1 | Array of 3 float. |
| v2 | Array of 3 float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void conja | ( | cuFloatComplex(&) | cv[3], |
| cuFloatComplex(&) | out[3] | ||
| ) |
Conjugate.
Conjugate complex valued vector of size 3.
| cv | Array of 3 complex float. |
| out | Array of 3 complex float. |
| __device__ __inline__ cuFloatComplex cuCaddSf | ( | cuFloatComplex | a, |
| float | b | ||
| ) |
Add scalar float to complex number.
| __device__ __inline__ cuFloatComplex cuCaddSf | ( | float | a, |
| cuFloatComplex | b | ||
| ) |
Add complex number to scalar float.
| __device__ __inline__ cuFloatComplex cuCdivSf | ( | cuFloatComplex | a, |
| float | b | ||
| ) |
Divide complex number by scalar float.
| __device__ __inline__ cuFloatComplex cuCdivSf | ( | float | a, |
| cuFloatComplex | b | ||
| ) |
Divide scalar by complex float.
| __device__ __inline__ cuFloatComplex cuCexpf | ( | cuFloatComplex | z | ) |
Take complex exponential.
Take complex exponential by decomposing into sine and cosine.
| __device__ __inline__ cuFloatComplex cuCmulSf | ( | cuFloatComplex | a, |
| float | b | ||
| ) |
Multiply complex number by scalar float.
| __device__ __inline__ cuFloatComplex cuCmulSf | ( | float | a, |
| cuFloatComplex | b | ||
| ) |
Multiply complex number by scalar float.
| __device__ __inline__ cuFloatComplex cuCsubSf | ( | cuFloatComplex | a, |
| float | b | ||
| ) |
Subtract scalar float from complex number.
| __device__ __inline__ cuFloatComplex cuCsubSf | ( | float | a, |
| cuFloatComplex | b | ||
| ) |
Add complex number to scalar float.
| __device__ __inline__ void diff | ( | cuFloatComplex(&) | cv1[3], |
| cuFloatComplex(&) | cv2[3], | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Component-wise vector difference.
Subtract two complex valued vectors of size 3, element-wise.
| cv1 | Array of 3 complex float. |
| cv2 | Array of 3 complex float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void diff | ( | float(&) | v1[3], |
| float(&) | v2[3], | ||
| float(&) | out[3] | ||
| ) |
Component-wise vector difference.
Subtract two real valued vectors of size 3, element-wise.
| v1 | Array of 3 float. |
| v2 | Array of 3 float. |
| out | Array of 3 float. |
| __device__ __inline__ void dot | ( | cuFloatComplex(&) | cv1[3], |
| cuFloatComplex(&) | cv2[3], | ||
| cuFloatComplex & | out | ||
| ) |
Dot product.
Take the dot (inner) product of two complex valued float arrays of size 3.
| cv1 | Array of 3 complex float. |
| cv2 | Array of 3 complex float. |
| out | Scalar complex float. |
| __device__ __inline__ void dot | ( | cuFloatComplex(&) | cv1[3], |
| float(&) | v2[3], | ||
| cuFloatComplex & | out | ||
| ) |
Dot product.
Take the dot (inner) product of one complex valued and one real valued float array of size 3.
| cv1 | Array of 3 complex float. |
| v2 | Array of 3 float. |
| out | Scalar complex float. |
| __device__ __inline__ void dot | ( | float(&) | v1[3], |
| cuFloatComplex(&) | cv2[3], | ||
| cuFloatComplex & | out | ||
| ) |
Dot product.
Take the dot (inner) product of one real valued and one complex valued float array of size 3.
| v1 | Array of 3 float. |
| cv2 | Array of 3 complex float. |
| out | Scalar complex float. |
| __device__ __inline__ void dot | ( | float(&) | v1[3], |
| float(&) | v2[3], | ||
| float & | out | ||
| ) |
Dot product.
Take the dot (inner) product of two real valued arrays of size 3.
| v1 | Array of 3 float. |
| v2 | Array of 3 float. |
| out | Scalar float. |
| __device__ __inline__ void dyad | ( | float(&) | v1[3], |
| float(&) | v2[3], | ||
| float(&) | out[3][3] | ||
| ) |
Dyadic product.
Calculate dyadic product between two real valued float vectors of size 3.
| v1 | Array of 3 float. |
| v2 | Array of 3 float. |
| out | Array of 3 float, nested inside array of size 3. |
| __device__ __inline__ void ext | ( | cuFloatComplex(&) | cv1[3], |
| cuFloatComplex(&) | cv2[3], | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Cross product.
Take the cross (outer) product of two complex valued float arrays of size 3.
| cv1 | Array of 3 complex float. |
| cv2 | Array of 3 complex float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void ext | ( | cuFloatComplex(&) | cv1[3], |
| float(&) | v2[3], | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Cross product.
Take the cross (outer) product of one complex valued and one real valued float array of size 3.
| cv1 | Array of 3 complex float. |
| v2 | Array of 3 float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void ext | ( | float(&) | v1[3], |
| cuFloatComplex(&) | cv2[3], | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Cross product.
Take the cross (outer) product of one real valued and one complex valued float array of size 3.
| v1 | Array of 3 float. |
| cv2 | Array of 3 complex float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void ext | ( | float(&) | v1[3], |
| float(&) | v2[3], | ||
| float(&) | out[3] | ||
| ) |
Cross product.
Take the cross (outer) product of two real valued float arrays of size 3.
| v1 | Array of 3 float. |
| v2 | Array of 3 float. |
| out | Array of 3 float. |
| __device__ __inline__ void invmatVec4 | ( | float(&) | mat[16], |
| float(&) | cv1[3], | ||
| float(&) | out[3], | ||
| bool | vec = false |
||
| ) |
Matrix-vector multiplication.
Multiply a vector by the inverse of a matrix.
| cv1 | Array of 3 float. |
| out | Array of 3 float. |
| vec | Whether to rotate as a vector or as a point. |
| __device__ __inline__ void matDiff | ( | float(&) | m1[3][3], |
| float(&) | m2[3][3], | ||
| float(&) | out[3][3] | ||
| ) |
Matrix difference, element wise.
Subtract two 3x3 matrices, element wise.
| m1 | Array of 3 float, nested inside array of size 3. |
| m2 | Array of 3 float, nested inside array of size 3. |
| out | Array of 3 float, nested inside array of size 3. |
| __device__ __inline__ void matVec | ( | float(&) | m1[3][3], |
| cuFloatComplex(&) | cv1[3], | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Matrix-vector product.
Multiply a real valued 3x3 matrix and a complex valued size 3 vector to generate a new complex valued size 3 vector.
| m1 | Array of 3 float, nested inside array of size 3. |
| cv1 | Array of 3 complex float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void matVec | ( | float(&) | m1[3][3], |
| float(&) | v1[3], | ||
| float(&) | out[3] | ||
| ) |
Matrix-vector product.
Multiply a real valued 3x3 matrix and a real valued size 3 vector to generate a new real valued size 3 vector.
| m1 | Array of 3 float, nested inside array of size 3. |
| v1 | Array of 3 float. |
| out | Array of 3 float. |
| __device__ __inline__ void matVec4 | ( | float(&) | mat[16], |
| float(&) | cv1[3], | ||
| float(&) | out[3], | ||
| bool | vec = false |
||
| ) |
Matrix-vector multiplication.
Uses mat from constant memory.
| cv1 | Array of 3 float. |
| out | Array of 3 float. |
| vec | Whether to rotate as a vector or as a point. |
| __device__ __inline__ void normalize | ( | float(&) | v[3], |
| float(&) | out[3] | ||
| ) |
Normalize vector.
Normalize real valued vector of size 3.
| v | Array of 3 float. |
| out | Array of 3 float. |
| __device__ __inline__ void s_mult | ( | cuFloatComplex(&) | cv[3], |
| const float & | s, | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Scalar multiplication.
Multiply complex valued vector of size 3 by real scalar, element-wise.
| cv | Array of 3 complex float. |
| s | Scalar float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void s_mult | ( | cuFloatComplex(&) | cv[3], |
| cuFloatComplex & | cs, | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Scalar multiplication.
Multiply complex valued vector of size 3 by complex scalar, element-wise.
| cv | Array of 3 complex float. |
| cs | Scalar complex float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void s_mult | ( | float(&) | v[3], |
| cuFloatComplex & | cs, | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Scalar multiplication.
Multiply real valued vector of size 3 by complex scalar, element-wise.
| v | Array of 3 float. |
| cs | Scalar complex float. |
| out | Array of 3 complex float. |
| __device__ __inline__ void s_mult | ( | float(&) | v[3], |
| float & | s, | ||
| float(&) | out[3] | ||
| ) |
Scalar multiplication.
Multiply real valued vector of size 3 by real scalar, element-wise.
| v | Array of 3 float. |
| s | Scalar float. |
| out | Array of 3 float. |
| __device__ __inline__ void snell | ( | cuFloatComplex(&) | cvin[3], |
| float(&) | normal[3], | ||
| cuFloatComplex(&) | out[3] | ||
| ) |
Snell's law reflection.
Calculate reflected direction vector from incoming direction and normal vector.
| cvin | Array of 3 complex float, incoming direction vector. |
| normal | Array of 3 float, normal vector of surface. |
| out | Array of 3 complex float. |
| __device__ __inline__ void snell | ( | float(&) | vin[3], |
| float(&) | normal[3], | ||
| float(&) | out[3] | ||
| ) |
Snell's law reflection.
Calculate reflected direction vector from incoming direction and normal vector.
| vin | Array of 3 float, incoming direction vector. |
| normal | Array of 3 float, normal vector of surface. |
| out | Array of 3 float. |
| __device__ __inline__ void snell_t | ( | float(&) | vin[3], |
| float(&) | normal[3], | ||
| float | mu, | ||
| float(&) | out[3] | ||
| ) |
Snell's law refraction.
Calculate refracted direction vector from incoming direction and normal vector.
| vin | Array of 3 double/float, incoming direction vector. |
| normal | Array of 3 double/float, normal vector of surface. |
| mu | Ratio of n1 to n2. |
| out | Array of 3 double/float. |