# mult: Callback-based Multiplication of Matrices In beerda/lfl: Linguistic Fuzzy Logic

## Description

Perform a custom multiplication of the matrices `x` and `y` by using the callback function `f`.

## Usage

 `1` ```mult(x, y, f, ...) ```

## Arguments

 `x` A first matrix. The number of columns must match with the number of rows of the `y` matrix. `y` A second matrix. The number of rows must match with the number of columns of the `x` matrix. `f` A function to be applied to the matrices in order to compute the multiplication. It must accept at least two arguments. `...` Additional arguments that are passed to the function `f`.

## Details

For a matrix `x` of size (u,v) and a matrix `y` of size (v,w), `mult` calls the function `f` uw-times to create a resulting matrix of size (u,w). Each (i,j)-th element of the resulting matrix is obtained from a call of the function `f` with `x`'s i-th row and `y`'s j-th column passed as its arguments.

## Value

A matrix with v rows and w columns, where v is the number of rows of `x` and w is the number of columns of `y`.

## Author(s)

Michal Burda

`compose()`
 ```1 2 3 4``` ``` x <- matrix(runif(24, -100, 100), ncol=6) y <- matrix(runif(18, -100, 100), nrow=6) mult(x, y, function(xx, yy) sum(xx * yy)) # the same as "x %*% y" ```