aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cblas/zrotg.c
diff options
context:
space:
mode:
authorshmel1k <shmel1k@ydb.tech>2022-09-02 12:44:59 +0300
committershmel1k <shmel1k@ydb.tech>2022-09-02 12:44:59 +0300
commit90d450f74722da7859d6f510a869f6c6908fd12f (patch)
tree538c718dedc76cdfe37ad6d01ff250dd930d9278 /contrib/libs/cblas/zrotg.c
parent01f64c1ecd0d4ffa9e3a74478335f1745f26cc75 (diff)
downloadydb-90d450f74722da7859d6f510a869f6c6908fd12f.tar.gz
[] add metering mode to CLI
Diffstat (limited to 'contrib/libs/cblas/zrotg.c')
-rw-r--r--contrib/libs/cblas/zrotg.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/contrib/libs/cblas/zrotg.c b/contrib/libs/cblas/zrotg.c
new file mode 100644
index 0000000000..4f41c1afcd
--- /dev/null
+++ b/contrib/libs/cblas/zrotg.c
@@ -0,0 +1,77 @@
+/* zrotg.f -- translated by f2c (version 20061008).
+ You must link the resulting object file with libf2c:
+ on Microsoft Windows system, link with libf2c.lib;
+ on Linux or Unix systems, link with .../path/to/libf2c.a -lm
+ or, if you install libf2c.a in a standard place, with -lf2c -lm
+ -- in that order, at the end of the command line, as in
+ cc *.o -lf2c -lm
+ Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
+
+ http://www.netlib.org/f2c/libf2c.zip
+*/
+
+#include "f2c.h"
+#include "blaswrap.h"
+
+/* Subroutine */ int zrotg_(doublecomplex *ca, doublecomplex *cb, doublereal *
+ c__, doublecomplex *s)
+{
+ /* System generated locals */
+ doublereal d__1, d__2;
+ doublecomplex z__1, z__2, z__3, z__4;
+
+ /* Builtin functions */
+ double z_abs(doublecomplex *);
+ void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
+ double sqrt(doublereal);
+ void d_cnjg(doublecomplex *, doublecomplex *);
+
+ /* Local variables */
+ doublereal norm;
+ doublecomplex alpha;
+ doublereal scale;
+
+/* .. Scalar Arguments .. */
+/* .. */
+
+/* Purpose */
+/* ======= */
+
+/* determines a double complex Givens rotation. */
+
+/* .. Local Scalars .. */
+/* .. */
+/* .. Intrinsic Functions .. */
+/* .. */
+ if (z_abs(ca) != 0.) {
+ goto L10;
+ }
+ *c__ = 0.;
+ s->r = 1., s->i = 0.;
+ ca->r = cb->r, ca->i = cb->i;
+ goto L20;
+L10:
+ scale = z_abs(ca) + z_abs(cb);
+ z__2.r = scale, z__2.i = 0.;
+ z_div(&z__1, ca, &z__2);
+/* Computing 2nd power */
+ d__1 = z_abs(&z__1);
+ z__4.r = scale, z__4.i = 0.;
+ z_div(&z__3, cb, &z__4);
+/* Computing 2nd power */
+ d__2 = z_abs(&z__3);
+ norm = scale * sqrt(d__1 * d__1 + d__2 * d__2);
+ d__1 = z_abs(ca);
+ z__1.r = ca->r / d__1, z__1.i = ca->i / d__1;
+ alpha.r = z__1.r, alpha.i = z__1.i;
+ *c__ = z_abs(ca) / norm;
+ d_cnjg(&z__3, cb);
+ z__2.r = alpha.r * z__3.r - alpha.i * z__3.i, z__2.i = alpha.r * z__3.i +
+ alpha.i * z__3.r;
+ z__1.r = z__2.r / norm, z__1.i = z__2.i / norm;
+ s->r = z__1.r, s->i = z__1.i;
+ z__1.r = norm * alpha.r, z__1.i = norm * alpha.i;
+ ca->r = z__1.r, ca->i = z__1.i;
+L20:
+ return 0;
+} /* zrotg_ */