rotmg¶
Computes the parameters for a modified Givens rotation.
Syntax
-
void
rotmg
(queue &exec_queue, buffer<T, 1> &d1, buffer<T, 1> &d2, buffer<T, 1> &x1, buffer<T, 1> &y1, buffer<T, 1> ¶m)¶
rotmg
supports the following precisions and devices.
T |
Devices Supported |
---|---|
|
Host, CPU, and GPU |
|
Host, CPU, and GPU |
Description
Given Cartesian coordinates (x
1, y
1) of an
input vector, the rotmg routines compute the components of a modified
Givens transformation matrix H
that zeros the y
-component of
the resulting vector:
\left[ \begin{array}{ccc} x1 \\ 0 \end{array} \right] = H \left[ \begin{array}{ccc} x1 & \sqrt{d1} \\ y1 & \sqrt{d2} \end{array} \right]
Input Parameters
- exec_queue
The queue where the routine should be executed.
- d1
Buffer holding the scaling factor for the
x
-coordinate of the input vector.- d2
Buffer holding the scaling factor for the
y
-coordinate of the input vector.- x1
Buffer holding the
x
-coordinate of the input vector.- y1
Scalar specifying the
y
-coordinate of the input vector.
Output Parameters
- d1
Buffer holding the first diagonal element of the updated matrix.
- d2
Buffer holding the second diagonal element of the updated matrix.
- x1
Buffer holding the x-coordinate of the rotated vector before scaling
- param
Buffer holding an array of size 5.
The elements of the
param
array are:param[0]
contains a switch,flag
. the other array elementsparam[1-4]
contain the components of the arrayH
:h
11,h
21,h
12, andh
22, respectively.Depending on the values of
flag
, the components ofH
are set as follows:flag = -1.0
:H = \left[ \begin{array}{ccc} h_{11} & h_{12} \\ h_{21} & h_{22} \end{array} \right]
flag = 0.0
:H = \left[ \begin{array}{ccc} 1.0 & h_{12} \\ h_{21} & 1.0 \end{array} \right]
flag = 1.0
:H = \left[ \begin{array}{ccc} h_{11} & 1.0 \\ -1.9 & h_{22} \end{array} \right]
flag = -2.0
:H = \left[ \begin{array}{ccc} 1.0 & 0.0 \\ 0.0 & 1.0 \end{array} \right]
In the last three cases, the matrix entries of 1.0, -1.0, and 0.0 are assumed based on the value of
flag
and are not required to be set in theparam
vector.