Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

Broadcasting dimension seems counter-intuitive #927

@CatchemAL

Description

@CatchemAL

Hi @cesarsouza ,

Is my intuition failing me here?

[Test]
public void BroadcastingTest()
{
    double[,] matrix = Matrix.Zeros(rows: 100, columns: 3);
    double[] vec = { 1, 2, 3 };

    double[,] broadcasted1 = matrix.Add(vec, dimension: 0); // works!     :O
    double[,] broadcasted2 = matrix.Add(vec, dimension: 1); // fails!     :\
}

Certainly took me by surprise. It's not a massive issue if you get an IndexOutOfRangeException but it's a lot harder to spot on square matrices.

Thanks,
A

ps - Perhaps my intuition agrees with yours (#902)?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions