Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
mir.sparse.blas.dot
License:
Authors:
Ilya Yaroshenko
- Unqual!(CommonType!(T1, T2))
dot
(V1 : Series!(I1*, T1*), V2 : Series!(I2*, T2*), T1, T2, I1, I2)(V1x
, V2y
);
Ddot
(D, V1 : Series!(I1*, T1*), V2 : Series!(I2*, T2*), T1, T2, I1, I2)(V1x
, V2y
); - Dot product of two vectorsParameters:
V1 x
sparse vector V2 y
sparse vector Returns:scalarx
ᵀ ×y
Examples:import mir.series; auto x = series([0u, 3, 5, 9, 100], [1, 3, 4, 9, 10]); auto y = series([1u, 3, 4, 9], [1, 10, 100, 1000]); // x = [1, 0, 0, 3, 0, 4, 0, 0, 0, 9, ... ,10] // y = [0, 1, 0, 10, 0, 0, 0, 0, 0, 1000] assert(dot(x, y) == 9030); assert(dot!double(x, y) == 9030);
- Unqual!(CommonType!(T1, ForeachType!V2))
dot
(V1 : Series!(I1*, T1*), T1, I1, V2)(V1x
, V2y
)
if (isDynamicArray!V2 || isSlice!V2);
Ddot
(D, V1 : Series!(I1*, T1*), T1, I1, V2)(V1x
, V2y
)
if (isDynamicArray!V2 || isSlice!V2); - Dot product of two vectors.Parameters:
V1 x
sparse vector V2 y
dense vector Returns:scalarx
×y
Examples:import mir.series; auto x = [0u, 3, 5, 9, 10].series([1.0, 3, 4, 9, 13]); auto y = [0.0, 1.0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; // x: [1, 0, 0, 3, 0, 4, 0, 0, 0, 9, 13, 0, 0, 0] // y: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] auto r = 0 + 3 * 3 + 4 * 5 + 9 * 9 + 13 * 10; assert(dot(x, y) == r); assert(dot(x, y.sliced) == r); assert(dot(x, y.slicedField) == r);
Copyright © 2016-2020 by Ilya Yaroshenko | Page generated by
Ddoc on Sun Nov 15 09:37:38 2020