Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

enoki::packet() does not work with Matrix<DynamicArray, 1> #92

Description

@anadodik

Code necessary for reproducing the bug:

#include <enoki/array.h>
#include <enoki/matrix.h>
#include <enoki/dynamic.h>

int main() {
    using Packet = enoki::Packet<float, 4>;
    using Value = enoki::DynamicArray<Packet>;
    using Matrix1 = enoki::Matrix<Value, 1>;
    using Matrix2 = enoki::Matrix<Value, 2>;

    auto matrix1 = enoki::zero<Matrix1>(2);
    auto matrix2 = enoki::zero<Matrix2>(2);

    enoki::packet(matrix1, 0) = 1;
    enoki::packet(matrix2, 0) = 1;

    std::cout << "matrix1=\n" << matrix1 << "\n";
    std::cout << "matrix2=\n" << matrix2 << "\n";

    return 0;
}

This produces the following output:

matrix1=
[[[0]],
 [[0]]]
matrix2=
[[[1, 1],
  [1, 1]],
 [[1, 1],
  [1, 1]]]

As you can see, matrix2 works fine, while matrix1 never gets assigned the value 1. This seems to be a bug to me as I don't see a reason why Enoki should not generalize to 1x1 matrices.

I tried debugging the issue myself, but wasn't able to find the cause. Please let me know if there is any way I can help to get this fixed.

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