The OpenD Programming Language

fillVandermonde

Fills a matrix with the terms of a geometric progression in each row.

void
fillVandermonde
(
F
SliceKind matrixKind
SliceKind kind
)
(
Slice!(F*, 2, matrixKind) matrix
,
Slice!(const(F)*, 1, kind) vec
)

Parameters

matrix Slice!(F*, 2, matrixKind)

m × n matrix to fill

vec Slice!(const(F)*, 1, kind)

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]]);

See Also

Meta