Skip to content

Conversation

@der-scheme
Copy link

Adds pattern matching support to Matrix and Vector, which can be used to extract features and enforce certain constraints.

Usage

m =  Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]]  # => Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
m in Matrix[[a, 2, 3], [4, b, 6], [7, 8, c]]  # => true
diagonal = [a, b, c]                          # => [1, 5, 9]
diagonal.sum == m.trace                       # => true
vec =  Vector[1, 2, 4, 5, 3]  # => Vector[1, 2, 4, 5, 3]
vec in Vector[1, 2, *ff , 3]  # => true
ff                            # => [4, 5]

…dvent of Pattern Matching)

Enables pattern matching on matrices and vectors, which can be used to extract features and enforce certain constraints.
Copy link
Member

@marcandre marcandre left a comment

Choose a reason for hiding this comment

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

LGTM 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants