@@ -10,8 +10,8 @@ The Level 1 GLAS perform vector and vector-vector operations.
1010$(BOOKTABLE $(H2 Vector-vector operations),
1111$(T2 rot, apply Givens rotation)
1212$(T2 axpy, constant times a vector plus a vector)
13- $(T2 dot, dot product, conjugating the first vector )
14- $(T2 dotu , dot product)
13+ $(T2 dot, dot product)
14+ $(T2 dotc , dot product, conjugating the first vector )
1515)
1616
1717$(BOOKTABLE $(H2 Vector operations),
@@ -295,7 +295,7 @@ F dot(F, size_t N, R1, R2)(Slice!(N, R1) x, Slice!(N, R2) y)
295295 {
296296 assert (x.shape == y.shape, " constraints: x and y must have equal shapes" );
297297 pragma (inline, false );
298- return ndReduce! (_fmuladdc , Yes.vectorized)(F(0 ), x, y);
298+ return ndReduce! (_fmuladd , Yes.vectorized)(F(0 ), x, y);
299299 }
300300}
301301
@@ -338,7 +338,7 @@ unittest
338338 assert (dot! real (x, y) == 5 + 12 + 21 ); // 80-bit FP for x86 CPUs
339339}
340340
341- // / CDOTC, ZDOTC
341+ // / CDOTU, ZDOTU
342342unittest
343343{
344344 import mir.ndslice.slice: slice;
@@ -349,10 +349,9 @@ unittest
349349 auto y = slice! cd(2 );
350350 x[] = [cd(0 , 1 ), cd(2 , 3 )];
351351 y[] = [cd(4 , 5 ), cd(6 , 7 )];
352- assert (dot(x, y) == cd(0 , - 1 ) * cd(4 , 5 ) + cd(2 , - 3 ) * cd(6 , 7 ));
352+ assert (dot(x, y) == cd(0 , 1 ) * cd(4 , 5 ) + cd(2 , 3 ) * cd(6 , 7 ));
353353}
354354
355-
356355/+ +
357356Forms the dot product of two complex vectors.
358357Uses unrolled loops for strides equal to one.
@@ -363,28 +362,28 @@ Params:
363362 y = second n-dimensional tensor
364363BLAS: CDOTU, ZDOTU
365364+/
366- F dotu (F, size_t N, R1 , R2 )(Slice! (N, R1 ) x, Slice! (N, R2 ) y)
365+ F dotc (F, size_t N, R1 , R2 )(Slice! (N, R1 ) x, Slice! (N, R2 ) y)
367366 if (isComplex! (DeepElementType! (typeof (x))) && isComplex! (DeepElementType! (typeof (y))))
368367{
369368 static if (allSatisfy! (_shouldBeCastedToUnqual, R1 , R2 ))
370369 {
371- return .dotu ! F(cast (Slice! (N, Unqual! R1 ))x, cast (Slice! (N, Unqual! R2 ))y);
370+ return .dotc ! F(cast (Slice! (N, Unqual! R1 ))x, cast (Slice! (N, Unqual! R2 ))y);
372371 }
373372 else
374373 {
375374 assert (x.shape == y.shape, " constraints: x and y must have equal shapes" );
376375 pragma (inline, false );
377- return ndReduce! (_fmuladd , Yes.vectorized)(F(0 ), x, y);
376+ return ndReduce! (_fmuladdc , Yes.vectorized)(F(0 ), x, y);
378377 }
379378}
380379
381380// / ditto
382- auto dotu (size_t N, R1 , R2 )(Slice! (N, R1 ) x, Slice! (N, R2 ) y)
381+ auto dotc (size_t N, R1 , R2 )(Slice! (N, R1 ) x, Slice! (N, R2 ) y)
383382{
384- return .dotu ! (Unqual! (typeof (x[x.shape.init] * y[y.shape.init])))(x, y);
383+ return .dotc ! (Unqual! (typeof (x[x.shape.init] * y[y.shape.init])))(x, y);
385384}
386385
387- // / CDOTU, ZDOTU
386+ // / CDOTC, ZDOTC
388387unittest
389388{
390389 import mir.ndslice.slice: slice;
@@ -395,7 +394,7 @@ unittest
395394 auto y = slice! cd(2 );
396395 x[] = [cd(0 , 1 ), cd(2 , 3 )];
397396 y[] = [cd(4 , 5 ), cd(6 , 7 )];
398- assert (dotu (x, y) == cd(0 , 1 ) * cd(4 , 5 ) + cd(2 , 3 ) * cd(6 , 7 ));
397+ assert (dotc (x, y) == cd(0 , - 1 ) * cd(4 , 5 ) + cd(2 , - 3 ) * cd(6 , 7 ));
399398}
400399
401400/+ +
0 commit comments