matmult: matmult

matmultR Documentation

matmult

Description

Matrix multiplication for numeric/float matrices.

Usage

## S4 method for signature 'float32,float32'
x %*% y

## S4 method for signature 'float32,matrix'
x %*% y

## S4 method for signature 'matrix,float32'
x %*% y

Arguments

x, y

Numeric/float matrices.

Details

If a numeric matrix is multiplied against a float matrix, then if the "numeric" matrix is integers, the integers are promoted to floats. Otherwise, the float matrix is promoted to doubles.

Value

A matrix of the same type as the highest precision input.

Examples

library(float)

s1 = flrunif(5, 5)
s2 = flrunif(5, 2)
x = matrix(1:25, 5)

s1 %*% s2 # float

storage.mode(x) # integer
x %*% s2 # float

storage.mode(x) = "double"
x %*% s2 # double


float documentation built on Feb. 16, 2023, 6:43 p.m.