Hi,
I have a 2D double array and I want to subtract from the first
column a value,
is this possible with matrix operation in D?
```
void main()
{
double[][] data = [[0.0, 1.4], [1.0, 5.2], [2.0, 0.8]];
// subtract -2.0 from the first column for every value
// Expected output
On 2/21/20 12:51 AM, Andre Pany wrote:
Hi,
I have a 2D double array and I want to subtract from the first column a
value,
is this possible with matrix operation in D?
```
void main()
{
double[][] data = [[0.0, 1.4], [1.0, 5.2], [2.0, 0.8]];
// subtract -2.0 from the first column fo
On Friday, 21 February 2020 at 11:53:02 UTC, Ali Çehreli wrote:
On 2/21/20 12:51 AM, Andre Pany wrote:
Hi,
I have a 2D double array and I want to subtract from the first
column a value,
is this possible with matrix operation in D?
```
void main()
{
double[][] data = [[0.0, 1.4], [1.0, 5
On Friday, 21 February 2020 at 11:53:02 UTC, Ali Çehreli wrote:
[snip]
auto byColumn(R)(R range, size_t n) {
return Column!R(range, n);
}
mir has byDim for something similar (numir also has alongDim).
This is how you would do it:
import mir.ndslice;
void main() {
auto x = [0.0, 1.4, 1.
On Friday, 21 February 2020 at 14:43:37 UTC, jmh530 wrote:
[snip]
Actually, I kind of prefer the relevant line as
x.byDim!1[0].each!"a -= 2";
which makes it a little clearer that you can easily change [0] to
[1] to apply each to the second column instead.
On Friday, 21 February 2020 at 08:51:49 UTC, Andre Pany wrote:
Hi,
I have a 2D double array and I want to subtract from the first
column a value,
is this possible with matrix operation in D?
```
void main()
{
double[][] data = [[0.0, 1.4], [1.0, 5.2], [2.0, 0.8]];
// subtract -2.0 fr
On Friday, 21 February 2020 at 13:42:24 UTC, Andre Pany wrote:
Mir is great and actually I try to rewrite some Python Pandas
Dataframe index logic.
Maybe mir.series [1] can work for you.
Series!(Key*, Value*) - is a pair of two 1D ndslices, they can be
sorted according to the first one ndslic
On Saturday, 22 February 2020 at 08:29:32 UTC, 9il wrote:
On Friday, 21 February 2020 at 13:42:24 UTC, Andre Pany wrote:
Mir is great and actually I try to rewrite some Python Pandas
Dataframe index logic.
Maybe mir.series [1] can work for you.
Series!(Key*, Value*) - is a pair of two 1D ndsl
On Saturday, 22 February 2020 at 08:29:32 UTC, 9il wrote:
[snip]
Maybe mir.series [1] can work for you.
I had a few other thoughts after looking at septc's solution of
using
y[0..$, 0] *= 100;
to do the calculation.
1) There is probably scope for an additional select function to
handle the