Skip to content

Exporting to h5 files gives unexpected results when exporting a view #180

Description

@spectre-ns

See the code snippet below:

int main()
{
	auto [a, b] = xt::meshgrid(xt::arange(10), xt::arange(10));
	auto a1 = xt::eval(a);
	auto b1 = xt::eval(b);
	using namespace std::complex_literals;

	auto v = xt::view(a1, xt::all(), xt::range(2, 4));
	xt::dump_hdf5("test.h5", "dataset_a", v);
	std::cout << v;
}

The output from std::cout does not match the result in the file. The implementation will accept any input presenting the T::data(). The data interface from the view does not add an offset into the valid region and simply yields a begin pointer to the underlying container.

Expected result:
{{2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
{3, 3, 3, 3, 3, 3, 3, 3, 3, 3}}

Result:
0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions