Skip to content

Square bracket operator for xgenerator not working #968

@martinRenou

Description

@martinRenou

The square bracket operator for xgenerator is not working like other implementations (for example xarray), the following code:

auto a = xt::eye<int>(9);
std::cout << "a (xgenerator): ";
for (std::size_t i = 0; i < 9; ++i)
{
    std::cout << a[i] << ", ";
}
std::cout << std::endl;

auto b = xt::xarray<int>({{1, 0, 0},
                          {0, 1, 0},
                          {0, 0, 1}});
std::cout << "b (xarray): ";
for (std::size_t i = 0; i < 9; ++i)
{
    std::cout << b[i] << ", ";
}
std::cout << std::endl;

outputs:

a (xgenerator): 1, 0, 0, 0, 0, 0, 0, 0, 0, 
b (xarray): 1, 0, 0, 0, 1, 0, 0, 0, 1,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions