Difference between revisions of "Function:MatMul"

From CUVI Wiki
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
Performs matrix multiplication
Performs matrix multiplication


===Function===
====Function====
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus matMul(const CuviImage& A,
CuviStatus matMul(const CuviImage& A,
                   const CuviImage& B,
                   const CuviImage& B,
                   CuviImage& C,
                   CuviImage& C,
                   const CuviStream& stream = CuviStream())
                   const CuviStream& stream = CuviStream());




</syntaxhighlight>
</syntaxhighlight>
|}
|}
===Parameters===


====Parameters====
{|
|style="font-size:75%;"|
{|class="wikitable"
{|class="wikitable"
|-
|-
Line 37: Line 39:
| CuviStream&
| CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution
 
|}
|}
|}


===Image Type Support===
====Image Type Support====
 
{|
|style="font-size:75%;"|
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 48: Line 51:
! Output
! Output
|-
|-
| 32f single channel
| 32fc1
| 32f single channel
| 32fc1
| 32f single channel
| 32fc1
|}
|}
|}


 
====Code Example====
===Example===
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">



Latest revision as of 20:17, 18 October 2022

Performs matrix multiplication

Function

CuviStatus matMul(const CuviImage& A,
                  const CuviImage& B,
                  CuviImage& C,
                  const CuviStream& stream = CuviStream());

Parameters

Name Type Description
A CuviImage& First Input Image
B CuviImage& Second Input Image
C CuviImage& Resultant Image
stream CuviStream& GPU stream ID for execution

Image Type Support

Input 1 Input 2 Output
32fc1 32fc1 32fc1

Code Example

CuviSize aSize(3,3);
CuviSize bSize(3,3);

//Initialize images
CuviImage A(aSize, CUVI_32FC1);
CuviImage B(bSize, CUVI_32FC1);

//Fill images with random values
cuvi::dataExchange::generateRandomImage(A);
cuvi::dataExchange::generateRandomImage(B);


CuviImage C;

//Perform matrix multiplication
cuvi::arithmeticLogical::matMul(A,B,C);