I am curious why all ifpack2 containers have two template parameters: MatrixType and LocalScalarType. For example,
Ifpack2::TriDiContainer<MatrixType, LocalScalarType>
Ifpack2::DenseContainer<MatrixType, LocalScalarType>
Ifpack2::BandedContainer<MatrixType, LocalScalarType>
Ifpack2::BlockTriDiContainer<MatrixType, LocalScalarType>
When do we have a case that LocalScalarType is different from typename MatrixType::scalar_type ?
@kyungjoo-kim That was meant to allow MatrixType::scalar_type to be something that isn't supported by Teuchos's LAPACK wrappers as a scalar (see the explanation at the top of BandedContainer_decl:82). As far as I know this feature isn't actually used anywhere, at least not within Ifpack2 or MueLu. The explicit instantiations for the Ifpack2 container classes don't use a different LocalScalarType, and the ContainerFactory doesn't support a different type.
@kyungjoo-kim wrote:
I am curious why all ifpack2 containers have two template parameters: MatrixType and LocalScalarType.
@brian-kelley has already explained this well (thanks! :-D ). The original idea was to have mixed-precision solves, where the vectors may have higher precision than the (local container's) matrix. Nobody ever used this capability in practice, as far as I know.
@brian-kelley @mhoemmen Yeah... that is what I suspected. As you pointed it out, it might be quite difficult to use mixed precision computation in a generic template based code. Especailly when it also needs to consider Sacado UQ types as potential scalar types, it is probably impossible to exploit different local scalar type (some compatibility issues). I kind of want to remove the local scalar type in the container I am working but I probably should leave it as it is.
@kyungjoo-kim If you are building a new container type that doesn't use LAPACK block solvers internally, there is no need to keep LocalScalarType as a template parameter. Removing it can't break code that uses the ContainerFactory interface, and it won't affect anyone using one of the default containers directly who does use a different LocalScalarType.