123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // File: xrotg.cpp
- //
- // MATLAB Coder version : 5.2
- // C/C++ source code generated on : 24-Mar-2023 11:40:08
- //
- // Include Files
- #include "fun9_xrotg.h"
- #include "rt_nonfinite.h"
- #include <cmath>
- // Function Definitions
- //
- // Arguments : double *a
- // double *b
- // double *c
- // double *s
- // Return Type : void
- //
- namespace coder {
- namespace internal {
- namespace blas {
- void xrotg(double *a, double *b, double *c, double *s)
- {
- double absa;
- double absb;
- double roe;
- double scale;
- roe = *b;
- absa = std::abs(*a);
- absb = std::abs(*b);
- if (absa > absb) {
- roe = *a;
- }
- scale = absa + absb;
- if (scale == 0.0) {
- *s = 0.0;
- *c = 1.0;
- *a = 0.0;
- *b = 0.0;
- } else {
- double ads;
- double bds;
- ads = absa / scale;
- bds = absb / scale;
- scale *= std::sqrt(ads * ads + bds * bds);
- if (roe < 0.0) {
- scale = -scale;
- }
- *c = *a / scale;
- *s = *b / scale;
- if (absa > absb) {
- *b = *s;
- } else if (*c != 0.0) {
- *b = 1.0 / *c;
- } else {
- *b = 1.0;
- }
- *a = scale;
- }
- }
- } // namespace blas
- } // namespace internal
- } // namespace coder
- //
- // File trailer for xrotg.cpp
- //
- // [EOF]
- //
|