15.cuBLAS开发指南中文版--cuBLAS中的Level-1函数rotg()

cuBLAS中的Level-1函数rotg()

在这里插入图片描述

2.5.9. cublas<t>rotg()

cublasStatus_t cublasSrotg(cublasHandle_t handle,
                           float           *a, float           *b,
                           float  *c, float           *s)
cublasStatus_t cublasDrotg(cublasHandle_t handle,
                           double          *a, double          *b,
                           double *c, double          *s)
cublasStatus_t cublasCrotg(cublasHandle_t handle,
                           cuComplex       *a, cuComplex       *b,
                           float  *c, cuComplex       *s)
cublasStatus_t cublasZrotg(cublasHandle_t handle,
                           cuDoubleComplex *a, cuDoubleComplex *b,
                           double *c, cuDoubleComplex *s)

此函数构造 Givens 旋转矩阵

G = c s - s c

将 2 × 1 向量 ( a , b ) T 的第二个条目归零。

然后,对于实数,我们可以写

c s - s c a b = r 0

其中 c 2 + s 2 = 1 和 r = a 2 + b 2 。 参数 a 和 b 分别被 r 和 z 覆盖。 z 的值使得 c 和 s 可以使用以下规则恢复:

( c , s ) = ( 1 - z 2 , z ) if | z | < 1 ( 0 . 0 , 1 . 0 ) if | z | = 1 ( 1 ∕ z , 1 - z 2 ) if | z | > 1

对于复数,我们可以写

c s - s ̄ c a b = r 0

其中 c 2 + ( s ̄ × s ) = 1 and r = a | a | × || ( a , b ) T || 2 with || ( a , b ) T || 2 = | a | 2 + | b | 2 for a ≠ 0 and r = b for a = 0。 最后,参数 a 在退出时被 r 覆盖。

Param.MemoryIn/outMeaning
handleinputhandle to the cuBLAS library context.
ahost or devicein/out<type> scalar that is overwritten with r .
bhost or devicein/out<type> scalar that is overwritten with z .
chost or deviceinputcosine element of the rotation matrix.
shost or deviceinputsine element of the rotation matrix.
Error ValueMeaning
CUBLAS_STATUS_SUCCESS操作成功完成
CUBLAS_STATUS_NOT_INITIALIZED库未初始化
CUBLAS_STATUS_EXECUTION_FAILED该功能无法在 GPU 上启动

请参考:
srotg, drotg, crotg, zrotg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

扫地的小何尚

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值