--- layout: stdlib-reference --- # mul ## Description Multiply. ## Signature
T mul<T>(
    T x,
    T y)
    where T : __BuiltinArithmeticType;

vector<T, N> mul<T, N:int>(
    vector<T, N> x,
    T y)
    where T : __BuiltinArithmeticType;

vector<T, N> mul<T, N:int>(
    T x,
    vector<T, N> y)
    where T : __BuiltinArithmeticType;

matrix<T, N, M> mul<T, N:int, M:int>(
    matrix<T, N, M> x,
    T y)
    where T : __BuiltinArithmeticType;

matrix<T, N, M> mul<T, N:int, M:int>(
    T x,
    matrix<T, N, M> y)
    where T : __BuiltinArithmeticType;

T mul<T, N:int>(
    vector<T, N> x,
    vector<T, N> y)
    where T : __BuiltinFloatingPointType;

T mul<T, N:int>(
    vector<T, N> x,
    vector<T, N> y)
    where T : __BuiltinIntegerType;

vector<T, M> mul<T, N:int, M:int>(
    vector<T, N> left,
    matrix<T, N, M> right)
    where T : __BuiltinFloatingPointType;

vector<T, M> mul<T, N:int, M:int>(
    vector<T, N> left,
    matrix<T, N, M> right)
    where T : __BuiltinIntegerType;

vector<T, M> mul<T, N:int, M:int>(
    vector<T, N> left,
    matrix<T, N, M> right)
    where T : __BuiltinLogicalType;

vector<T, N> mul<T, N:int, M:int>(
    matrix<T, N, M> left,
    vector<T, M> right)
    where T : __BuiltinFloatingPointType;

vector<T, N> mul<T, N:int, M:int>(
    matrix<T, N, M> left,
    vector<T, M> right)
    where T : __BuiltinIntegerType;

vector<T, N> mul<T, N:int, M:int>(
    matrix<T, N, M> left,
    vector<T, M> right)
    where T : __BuiltinLogicalType;

matrix<T, R, C> mul<T, R:int, N:int, C:int>(
    matrix<T, R, N> left,
    matrix<T, N, C> right)
    where T : __BuiltinFloatingPointType;

matrix<T, R, C> mul<T, R:int, N:int, C:int>(
    matrix<T, R, N> left,
    matrix<T, N, C> right)
    where T : __BuiltinIntegerType;

matrix<T, R, C> mul<T, R:int, N:int, C:int>(
    matrix<T, R, N> left,
    matrix<T, N, C> right)
    where T : __BuiltinLogicalType;

DifferentialPair<vector<T, M>> mul<T, N:int, M:int>(
    DifferentialPair<vector<T, N>> left,
    DifferentialPair<matrix<T, N, M>> right)
    where T : __BuiltinFloatingPointType;

DifferentialPair<vector<T, N>> mul<T, N:int, M:int>(
    DifferentialPair<matrix<T, N, M>> left,
    DifferentialPair<vector<T, M>> right)
    where T : __BuiltinFloatingPointType;

DifferentialPair<matrix<T, R, C>> mul<T, R:int, N:int, C:int>(
    DifferentialPair<matrix<T, R, N>> left,
    DifferentialPair<matrix<T, N, C>> right)
    where T : __BuiltinFloatingPointType;

void mul<T, R:int, N:int, C:int>(
    inout DifferentialPair<matrix<T, R, N>> left,
    inout DifferentialPair<matrix<T, N, C>> right,
    matrix<T, R, C> dOut)
    where T : __BuiltinFloatingPointType;

## Generic Parameters #### T: [\_\_BuiltinArithmeticType](../interfaces/0_builtinarithmetictype-029j/index.html) #### N : int #### M : int #### T: [\_\_BuiltinFloatingPointType](../interfaces/0_builtinfloatingpointtype-029hm/index.html) #### T: [\_\_BuiltinIntegerType](../interfaces/0_builtinintegertype-029g/index.html) #### T: [\_\_BuiltinLogicalType](../interfaces/0_builtinlogicaltype-029g/index.html) #### R : int #### C : int ## Parameters #### x : [T](mul.html#typeparam-T) The first value. #### y : [T](mul.html#typeparam-T) The second value. #### x : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> The first value. #### y : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> The second value. #### x : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> The first value. #### y : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> The second value. #### left : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N)\> #### right : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> #### left : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M)\> #### right : [vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), M\> #### left : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [R](../types/matrix/index.html#decl-R), [N](../types/matrix/index.html#decl-N)\> #### right : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [C](../types/matrix/index.html#decl-C)\> #### left : [DifferentialPair](../types/differentialpair-0c/index.html)\<[vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), [N](../types/vector/index.html#decl-N) \>\> #### right : [DifferentialPair](../types/differentialpair-0c/index.html)\<[matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M) \>\> #### left : [DifferentialPair](../types/differentialpair-0c/index.html)\<[matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [M](../types/matrix/index.html#decl-M) \>\> #### right : [DifferentialPair](../types/differentialpair-0c/index.html)\<[vector](../types/vector/index.html)\<[T](../types/vector/index.html#typeparam-T), M \>\> #### left : [DifferentialPair](../types/differentialpair-0c/index.html)\<[matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [R](../types/matrix/index.html#decl-R), [N](../types/matrix/index.html#decl-N) \>\> #### right : [DifferentialPair](../types/differentialpair-0c/index.html)\<[matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [N](../types/matrix/index.html#decl-N), [C](../types/matrix/index.html#decl-C) \>\> #### dOut : [matrix](../types/matrix/index.html)\<[T](../types/matrix/t-0.html), [R](../types/matrix/index.html#decl-R), [C](../types/matrix/index.html#decl-C)\> ## Return value The inner product of x and y. ## Availability and Requirements Defined for the following targets: #### hlsl Available in all stages. #### glsl Available in all stages. #### cpp Available in all stages. #### cuda Available in all stages. #### metal Available in all stages. #### spirv Available in all stages.