This adds a short path for LinearOperator.repeat() if we would otherwise create a new BatchRepeatLinearOperator which would be a no-op.
repeat() is called like this for example by the constructor of KroneckerProductLinearOperator.
By reducing one level of indirection, we gain two benefits: a) slightly better performance (obviously), and b) some more optimizations by calling native functions instead of default LinearOperator functions, e.g. for _diagonal().
Seems like there were no unit tests before, so I added tests for both cases: A No-Op case and a true case. I also allowed the repeat(1, 1) case as this is a no-op, too.
This adds a short path for LinearOperator.repeat() if we would otherwise create a new
BatchRepeatLinearOperator
which would be a no-op.repeat()
is called like this for example by the constructor ofKroneckerProductLinearOperator
.By reducing one level of indirection, we gain two benefits: a) slightly better performance (obviously), and b) some more optimizations by calling native functions instead of default
LinearOperator
functions, e.g. for_diagonal()
.