Takes the sum of the |Re(.)| + |Im(.)|'s of a vector and returns a single precision result.
Takes the sum of the |Re(.)| + |Im(.)|'s of a vector and returns a single precision result.
Takes the sum of the |Re(.)| + |Im(.)|'s of a vector and returns a single precision result.
Constant times a vector plus a vector. Uses unrolled loops for strides equal to one.
Forms the dot product of two vectors. Uses unrolled loops for strides equal to one.
Forms the dot product of two complex vectors. Uses unrolled loops for strides equal to one.
Finds the index of the first element having maximum |Re(.)| + |Im(.)|. Return: index of the first element having maximum |Re(.)| + |Im(.)|
Returns the euclidean norm of a vector. Uses unrolled loops for stride equal to one.
Applies a plane rotation, where the c (cos) and s (sin) are scalars. Uses unrolled loops for strides equal to one.
Forms the square of the euclidean norm. Uses unrolled loops for stride equal to one.
SWAP
import std.algorithm.mutation: swap; import mir.ndslice.allocation: slice; import mir.algorithm.iteration: each; import std.typecons: Yes; auto x = slice!double(4); auto y = slice!double(4); x[] = [0, 1, 2, 3]; y[] = [4, 5, 6, 7]; each!(swap)(x, y); assert(x == [4, 5, 6, 7]); assert(y == [0, 1, 2, 3]);
SCAL
import mir.ndslice.allocation: slice; import std.typecons: Yes; auto x = slice!double(4); x[] = [0, 1, 2, 3]; x[] *= 2.0; assert(x == [0, 2, 4, 6]);
COPY
import mir.ndslice.allocation: slice; auto x = slice!double(4); auto y = slice!double(4); x[] = [0, 1, 2, 3]; y[] = x; assert(y == [0, 1, 2, 3]);
Copyright © 2016-, Ilya Yaroshenko
Level 1
This is a submodule of mir.glas.
The Level 1 GLAS perform vector and vector-vector operations.
Vector-vector operations
Vector operations
All functions except iamax work with multidimensional tensors.
GLAS does not provide swap, scal, and copy functions. This functionality is part of ndslice package. Examples can be found below.