Skip to content

Add a message to the Exception in dense_sandwich#248

Merged
Marc-Antoine Schmidt (MarcAntoineSchmidtQC) merged 1 commit into
Quantco:mainfrom
jjerphan:dense_sandwich-exception
Apr 21, 2023
Merged

Add a message to the Exception in dense_sandwich#248
Marc-Antoine Schmidt (MarcAntoineSchmidtQC) merged 1 commit into
Quantco:mainfrom
jjerphan:dense_sandwich-exception

Conversation

@jjerphan
Copy link
Copy Markdown
Contributor

Fixes #208.

This is a simple fix.

I think that there are several alternatives if the provided array isn't contiguous:

  • make a copy of this array
  • raise an Exception as soon as possible, i.e. at the creation of:
    • DenseMatrix
    • SparseMatrix
    • SplitMatrix

Which one do you think is more appropriate?

Fixes Quantco#208.

Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
@MarcAntoineSchmidtQC
Copy link
Copy Markdown
Member

Thanks Julien Jerphanion (@jjerphan)! This was indeed pretty badly documented.

I think it would make sense to check for contiguity as soon as possible. I would probably then print a warning and copy the array so it becomes contiguous. If the operation is too memory intensive, the user will see the warning and hopefully fix the root cause.

We can still merge this fix asap and work on this further improvement in the future.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

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.

Cannot sandwich SplitMatrix with non-owned array

2 participants