cornellius-gp / linear_operator

A LinearOperator implementation to wrap the numerical nuts and bolts of GPyTorch
MIT License
95 stars 28 forks source link

Edits to generic `add`, `BlockDiagLinearOperator`'s `matmul`, and documentation #10

Closed SebastianAment closed 2 years ago

SebastianAment commented 2 years ago

This PR makes three small changes:

1) It introduces a size check in BlockDiagLinearOperator's matmul. This takes care of an edge case where the blocks of two block diagonal operators have different sizes, even though the operators have the same size. E.g. One operator has twice as many blocks of half the size as the other.

2) It introduces a deepcopy in the generic __add__ method for addition with a ZeroLinearOperator, see the discussion here.

3) It makes edits to the docs, which referenced the old lazy submodule, instead of the new operators.

SebastianAment commented 2 years ago

While thinking about the sizes in matmul, I noticed that the docs of BlockLinearOperator imply that the blocks should be square. If we don't want to support rectangular blocks, I'd also add a quick check in the constructor of BlockLinearOperator to make sure the blocks are indeed square.