Skip to content

Float32 support #35

Description

@delta-leader

Template the following classes (with hardcoded "double" in the rest of the code):

  • Dense
  • LowRank
  • Hierarchical
  • MatrixProxy, Matrix? (should not be necessary)
  • IndexRange (split_like function)
  • MatrixInitializer (no template necessary, can fill any type of matrix)
  • MatrixInitializerFile (no template necessary, reads doubles and can fill any type of matrix)
  • MatrixInitializerBlock (template for the datatype of the matrix to be copied from, can fill any type of matrix)
  • MatrixInitializerFunction(template for the matrix kernel, can only fill double matrix from double function
  • MatrixKernel (removed for now)

Template functions so that they can support both double and float:

  • Initialization:
  • Functions (kernels for filling matrices - currently limited to double params)
  • Find a better solution for filling from functions/kernels
  • Misc:
  • split (Hierarchical; note that his calls an omm that does not work for float yet)
  • get_dim
  • misc
  • morton_index (not templated because currently not in use)
  • norm
  • resize
  • transpose
  • randomized:
  • rid
  • rsvd
  • operations:
  • addition (plus operator finished - extend to OMM?)
  • multiplication (what happens in case of float*double?)
  • subtraction

Extend classes to "float" - OMM:

  • Dense - Constructor from MatrixProxy (If MatrixProxy is not of the same Type a bad_cast exception is thrown instead of omm_error and aborting; EDIT: found a solution that works with YOMM)
  • Dense - Constructor from Matrix (no float types for Hierarchical and LowRank yet)
  • Dense - implicit type conversion? (currently only explicit conversion allowed)
  • Matrix Proxy (both clone and move_clone)

Extend functions to "float" - OMM:

  • Misc:
  • get_dim
  • resize
  • norm
  • BLAS (What to do with double parameters for BLAS calls?):
  • gemm (alpha, beta remain double, template type is deduced depending on the type of Matrix passed in)
  • trmm
  • trsm
  • LAPACK:
  • gepq3
  • geqrt
  • id
  • larfb
  • lartms
  • qr
  • svd (template specialization for float and double)
  • tpmqrt
  • tpqrt
  • Util:
  • experiment_setup
  • geometry_file (not templated since parameters remain double)
  • get_memory_usage
  • global_key_value (no template needed)
  • l2_error
  • omm_error_handler (no template needed)
  • print
  • timer (no template needed)
  • Arithmetic:
  • subtraction
  • addition
  • merge_col_basis
  • merge_row_basis

Write test functions:

  • Initialization:
  • ClusterTree
  • IndexRange
  • MatrixFunctions
  • MatrixInitializer (except coordinate based admissibility for Kernel)
  • Dense:
  • Standard Constructor, Construct from dimensions and Copy-Constructor
  • Construct from Kernel
  • Construct from other Matrix types
  • Construct from MatrixProxy
  • Construct from File?
  • Assignment (currently only allowed for identical datatypes)
  • split function (currently only for double)
  • LowRank:
  • Standard Constructor, Construct from 3 matrices
  • Construct from Dense
  • Hierarchical:
  • Constructors (except from file)
  • operations:
  • addition (currently only for dense)
  • subtraction?
  • scalar multiply?
  • BLAS:
  • gemm
  • trmm
  • trsm
  • LAPACK:
  • gepq3
  • geqrt
  • id
  • larfb
  • lartms
  • qr
  • svd
  • tpmqrt
  • tpqrt
  • Misc:
  • get_dim
  • misc
  • morton_index
  • norm
  • resize
  • transpose
  • randomized:
  • rid
  • rsvd
  • util:
  • experiment_setup
  • geometry_file (not templated since parameters remain double)
  • get_memory_usage
  • global_key_value (no template needed)
  • l2_error
  • omm_error_handler (no template needed)
  • print
  • timer (no template needed)

Requires addition of the corresponding float functions from BLAS/LAPACK:

  • BLAS - float
  • LAPACK - float
  • Define operations between double and float?

Notes:
Prioritize getting a working single-precision implementation with a hierarchical LU test-case. Other test cases can be added later and the limitations described below should only be addressed if there is an actual need for their functionality.

Initialization from Kernel-Functions is still considerably restricted. The following limitations apply:

  • Geometry information can only be
  • Random number generators can only be
  • Seed for the random number generators can not be set
  • Admissibility can not be passed as a function
  • Only pre-defined kernel-functions are available

There are also some shortcomings in arithmetics:

  • Addition operator += is defined for all matrix types while operator + is only defined for dense
  • Subtraction operator -= is not defined
  • Multiplication (Scalar) is only defined for double (restrict? allow for mixed precision?)
  • Multiplication (Scalar) operator * is not defined

Investigate how a MatrixProxy is conerted into a Matrix (i.e. is that template safe?)
Automatic template deduction does not work for return type, in some cases old C style might be better (include return type as argument)
Shall we change the return value of functions that return a double to float?

Metadata

Metadata

Assignees

No one assigned

    Labels

    #highhigh-priority task

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions