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.ndslice.filling

This is a submodule of mir.ndslice.
Initialisation routines.
License:
Authors:
Ilya Yaroshenko
void fillVandermonde(F, SliceKind matrixKind, SliceKind kind)(Slice!(F*, 2, matrixKind) matrix, Slice!(const(F)*, 1, kind) vec);
Fills a matrix with the terms of a geometric progression in each row.
Parameters:
Slice!(F*, 2, matrixKind) matrix m × n matrix to fill
Slice!(const(F)*, 1, kind) vec vector of progression coefficients length of m
Examples:
import mir.ndslice.slice: sliced;
import mir.ndslice.allocation: uninitSlice;
auto x = [1.0, 2, 3, 4, 5].sliced;
auto v = uninitSlice!double(x.length, x.length);
v.fillVandermonde(x);
assert(v ==
    [[  1.0,   1,   1,   1,   1],
     [  1.0,   2,   4,   8,  16],
     [  1.0,   3,   9,  27,  81],
     [  1.0,   4,  16,  64, 256],
     [  1.0,   5,  25, 125, 625]]);