Skip to content

Conversation

@ThreeMonth03
Copy link
Collaborator

@ThreeMonth03 ThreeMonth03 commented Oct 28, 2025

According the discussion in issue #601 and pr #607, I move some operations from kalman filter to SimpleArray, including:

  • eye
  • scaled_eye
  • symmetrize
  • hermitian

Copy link
Collaborator Author

@ThreeMonth03 ThreeMonth03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yungyuc You could review this pull request. Thanks.

Comment on lines +1057 to +1060
template <typename A, typename T>
class SimpleArrayMixinMatrix
{

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are 2d operations, so I name the class SimpleArrayMixinMatrix. How do you think?

Comment on lines +1113 to +1139
A symmetrize() const
{
auto athis = static_cast<A const *>(this);
validate_square("symmetrize");
A result = *athis;
if constexpr (is_complex_v<value_type>)
{
for (ssize_t i = 0; i < athis->shape(0); ++i)
{
for (ssize_t j = 0; j < athis->shape(1); ++j)
{
result(i, j) = (result(i, j) + (*athis)(j, i).conj()) / static_cast<value_type>(2.0);
}
}
}
else
{
for (ssize_t i = 0; i < athis->shape(0); ++i)
{
for (ssize_t j = 0; j < athis->shape(1); ++j)
{
result(i, j) = (result(i, j) + (*athis)(j, i)) / static_cast<value_type>(2.0);
}
}
}
return result;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the following functions, but I noticed that the add function doesn't support the non-contiguous SimpleArray.

result.hermitian().add(*athis).mul(0.5);

Therefore, I implement the function without calling the function add().

Comment on lines -210 to -218
static array_type create_noise_matrix(size_t size, real_type noise_var)
{
return array_type::eye(size).mul(static_cast<T>(noise_var));
}
void check_dimensions();
void check_measurement(array_type const & z);
void check_control(array_type const & u);
static array_type symmetrize(array_type const & p);
static array_type hermitian(array_type const & a);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these helper functions.

}; /* end class SimpleArrayMixinSearch */

template <typename A, typename T>
class SimpleArrayMixinMatrix
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we need to have a well-defined matrix class first.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is impossible to define a matrix class well at the moment. Doing that now is over-engineering.

We will do it later.

@yungyuc yungyuc changed the title Implement basic 2d SimpleArray operation. Implement basic 2d SimpleArray operation Oct 30, 2025
@yungyuc yungyuc added the array Multi-dimensional array implementation label Oct 30, 2025
Copy link
Member

@yungyuc yungyuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Point to address:

  • In testing, add code to check the error messages for wrong shape. (eye does not have it.)

}; /* end class SimpleArrayMixinSearch */

template <typename A, typename T>
class SimpleArrayMixinMatrix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is impossible to define a matrix class well at the moment. Doing that now is over-engineering.

We will do it later.

):
sarr2.idiv(sarr1)

def test_eye(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also test for wrong shape input.

self.assertEqual(shermitian.shape, ndhermitian.shape)
np.testing.assert_equal(shermitian.ndarray, ndhermitian)

def test_hermitian_error(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider to merge the error checking into the main test function as a section. It looks like over-engineering to split at this early stage.

@yungyuc
Copy link
Member

yungyuc commented Nov 1, 2025

@ThreeMonth03 any update?

@ThreeMonth03
Copy link
Collaborator Author

@ThreeMonth03 any update?

Sorry, not yet. I was a bit lost with my new job last week and spent most of the time reading the company’s code.
In the near term, I’ll probably focus on finishing the conference slides first.
If you’d like to assign some issues to others, please feel free to do so.

@yungyuc yungyuc assigned ThreeMonth03 and unassigned ThreeMonth03 Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

array Multi-dimensional array implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants