clVector Record

Source: clMtxExpr.cs · Assembly: Dew.Math

public struct clVector

Open CL vector class with overloaded operators.

Declare clVector to run computation on Open CL Be carefull to declare clVector only for local variables with short lifetime. Call the Create method for clVector, if the variable is a global variable or a variable with a longer life.If the Create method (constuctor) is called, the clVector creates its own memory object in GPU memory, otherwise object cache is used.

Examples

csharp
clVector b;
clVector c;
TSingleArray bv;
b = clVector(TDoubleArray.Create(1,1,1,1)); b = new double[] {1,1,1,1};
b.Scale(2);
c = b*2 + Cplx(2,3); c = b*2 + 2 + 3i

b.Add(c);
b.CopyToArray(bv); //copy data back to host from GPU

Properties

NameTypeDescription
DeviceTOpenCLDeviceReturns the device on which we allocated memory for this object.
IsSubRangeBooleanAutomatically set to true after the SetSubIndex or SetSubRange call.

Methods

NameDescription
Abs (4)Absolute values.
Add (12)Adds complex Value to all calling object complex elements.
AddProduct (2)Add a product of two vectors.
AddScaled (4)Add each of Vec elements to corresponding elements in the calling object.
ArcCos (4)The inverse cosine.
ArcCosh (4)Inverse hyperbolic cosine.
ArcCot (4)Inverse cotangens.
ArcCoth (4)Inverse hyperbolic cotangens.
ArcCsc (4)Inverse cosecant.
ArcCsch (4)Inverse hyperbolic cosecant.
ArcSec (4)Inverse secant.
ArcSech (4)Inverse hyperbolic secant.
ArcSin (4)The inverse sine.
ArcSinh (4)Inverse hyperbolic sine.
ArcTan (4)Inverse tangens.
ArcTan2 (2)Inverse tangens of Y/X.
ArcTanh (4)Inverse hyperbolic tangens.
CartToPolar (2)Converts elements from cartesian to polar coordinate form.
Cbrt (4)The cube root.
Ceil (4)Rounds towards positive infinity.
Conj (4)Conjugate.
ConjMul (4)Conjugate and multiply.
Copy (2)Copy object values.
Cos (4)Cosine.
Cosh (4)Hyperbolic cosine.
Cot (4)Cotangens.
Coth (4)Hyperbolic cotangens.
CplxToReal (2)Split complex calling object in real and imaginary part.
Csc (4)Cosecant.
Csch (4)Hyperbolic cosecant.
DifferenceCalculate the difference for all Vec elements.
DisableSelectPrevents calls to Dew.Math.clVector.Select.
DisableSubrangePrevents calls to Dew.Math.clVector.SetSubRange.
Divide (4)Divide each of calling vector elements with corresponding elements in the Vec object.
DivideBy (8)Divide complex Value with elements of the calling object.
DotProd (4)Scalar product of two real arrays.
DotProdc (4)Scalar product of two complex arrays.
DownSampleDownsamples vector values.
EnableSelectEnables calls to Dew.Math.clVector.Select.
EnableSubrangeEnables calls to Dew.Math.clVector.SetSubRange.
Erf (4)Error functon of values.
Erfc (4)Complementary error functon of values.
Exp (4)Exponent (e^).
Exp10 (4)Exponent base 10 (10^).
Exp2 (4)Exponent base 2 (2^).
Expj (3)A complex exponential e^(j*Omega)).
ExtendToComplex (3)Extend Vec object to complex calling object.
FixAngle (4)Sets angle in [-2PI,2PI].
Flip (4)Flips the real and imaginary part of complex numbers.
FlipConj (4)Flips the real and imaginary part of complex numbers and conjugates the complex numbers.
Floor (4)Rounds towards negative infinity.
Frac (4)Fractional part of values.
ImagPart (2)Gets the imaginary part of a complex object.
IntPower (2)Calculate the power Base^(Exponent) for all Base object elements.
Inv (4)Inverse elements.
InvCbrt (4)The inverse of cube root 1/(v)^1/3.
InvSqrt (4)The inverse of square root 1/(v)^1/2.
Ln (4)Natural logarithm.
Log10 (4)Log base 10.
Log2 (4)Log base 2.
LogN (4)Log base N.
Mag (4)Magnitude.
Max (6)Maximum value.
Maxc (3)Maximum value.
MaxMin (4)Maximum and minimum value in a single pass.
Mean (5)Mean value.
Meanc (4)Mean value.
Min (6)Minimum value.
Minc (3)Minimum value.
Mul (12)Multiply all calling object elements with complex Value in-place.
MulI (4)Multiply elements by imaginary unit I.
NormThe norm of a vector.
Normalize (4)Normalize Vec object by subtracting a complex constant SubOffset from Vec elements and dividing the result by real constant DivFactor.
NormC (4)Calculate the C-norm of calling vector.
NormL1 (4)Calculate the L1-norm of the calling vector.
NormL2 (4)Calculate the L2-norm of the calling vector.
PhaseSpectrum (2)The phase angles (spectrum) of object elements.
PolarToCart (2)Converts the polar magnitude/phase pairs to cartesian pairs.
Power (7)Raises all calling vector elements to complex power Exponent in-place.
PowerSpectrum (2)The power spectrum from object complex values.
PowerVecRaises Base object elements to Exponent object elements power.
Product (6)Elements product.
Productc (2)Elements product.
Ramp (7)Fills the calling vector with a series following linear rule.
RealPart (2)Gets real part of complex object values.
RealToCplx (2)Constructs a complex object from two real objects.
Rem (4)The Reminder after division X/Y.
Reverse (3)Reverse all Vec elements.
RMSStandard deviation.
Rotate (2)A cyclic shift on vector elements.
Round (4)Elements rounded to the nearest whole number.
Scale (4)Multiply all calling object elements with a complex Value in-place.
Sec (4)Secant.
Sech (4)Hyperbolic secant.
Select (2)Resets the selection.
SelectAllResets any defined selection.
SetFullRangeResets any defined subrange.
SetSubIndex (2)Defines a subarray.
SetSubRange (4)Sets the subarray size to full size.
SetVal (4)Set all calling object complex elements to complex Value.
SetZero (2)Initializes object elements to zero.
Sgn (4)Computes signum function of calling object elements.
SgnMulSignum.
ShiftA shift on vector elements in range.
Sign (4)Changes elements sign.
Sin (4)Sine function.
SinCos (2)Sine and cosine.
Sinh (4)Hyperbolic sine.
SinhCosh (2)Hyperbolic sine and cosine.
Sqr (4)Square.
Sqrt (4)Square root.
StdDev (4)Standard deviation.
Sub (12)Subtracts complex Value from all calling object complex elements.
SubFrom (8)Subtract each of calling object elements from complex Value.
Sum (5)Sums vector values.
SumAndSqrSum (2)Computes the sum and the sum of squared elements from the elements in the calling object.
Sumc (2)Sum (complex value).
Tan (4)Tangens.
Tanh (4)Hyperbolic tangens.
ThreshBottom (4)Perform threshold operation on all Src object values.
ThresholdGT (8)Perform "greater than" threshold operation for complex numbers on all Vec object values.
ThresholdGT_LT (4)Perform "greater than and less than" threshold operation on all Vec object values.
ThresholdLT (8)Perform "less than" threshold operation for complex numbers on all Vec object values.
ThreshTop (4)Perform threshold operation on all Src object values.
Trunc (4)Rounds a real number towards zero.
TruncAndFrac (2)Rounds a real number towards zero and returns the fractional part.
UpSampleInserts zeroes between consecutive vector values.

Operators

NameDescription
op_Addition (7)Add left to all elements in Right and return result.
op_Division (7)Divide Left with all elements Right.
op_Multiply (7)Multiply all elements in Right with Left.
op_Subtraction (7)Subtract all elements in Right from Left.
op_UnaryNegationNegates all values inside AValue.