---
name: "RsbMatrix"
section: "3"
platform: "linux"
package: "librsb-dev"
version: "1.3.0.2+dfsg-7"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/RsbMatrix"
---

# RsbMatrix(3)

Represent a sparse matrix in RSB format by means of librsb.

## NAME

RsbMatrix - Represent a sparse matrix in RSB format by means of `librsb`.

## SYNOPSIS

`#include <rsb.hpp>`

### Public Types

enum **RsbSym** { **IsGen** = RSB\_FLAG\_NOFLAGS, **IsHer** = RSB\_FLAG\_HERMITIAN, **IsSym** = RSB\_FLAG\_SYMMETRIC, **IsTri** = RSB\_FLAG\_TRIANGULAR }\

### Public Member Functions

**RsbMatrix** (**rsb\_coo\_idx\_t** **nrA**, **rsb\_coo\_idx\_t** **ncA**, **const** **RsbSym** **sym**=**IsGen**)\
 **RsbMatrix** (**rsb\_coo\_idx\_t** **nrA**, **const** **rsb\_coo\_idx\_t** \***RP**, **const** **rsb\_coo\_idx\_t** \***JA**, **const** NT \***VA**, **const** **RsbSym** **sym**=**IsGen**)\
 **RsbMatrix** (**const** **rsb\_coo\_idx\_t** \***IA**, **const** **rsb\_coo\_idx\_t** \***JA**, **const** NT \***VA**, **rsb\_nnz\_idx\_t** **nnzA**, **const** **rsb\_flags\_t** **flagsA**=**RSB\_FLAG\_NOFLAGS**)\
 **RsbMatrix** (**const** **rsb\_char\_t** \***filename**, **const** **RsbSym** **sym**=**IsGen**)\
 **RsbMatrix** (**const** **RsbMatrix** &**A\_Rsb**, **bool** **do\_trans**=**false**, **rsb\_flags\_t** **flagsA**=**RSB\_FLAG\_NOFLAGS**)\
 **RsbMatrix** (**RsbMatrix** &&**other**)\
 **~RsbMatrix** (**void**)\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **\_add** (**rsb\_coo\_idx\_t** **i**, **rsb\_coo\_idx\_t** **j**, NT **val**)\
 **RSBP\_RVT** **Err\_t** **close** (**void**)\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **\_close** (**void**)\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **spmv** (**rsb\_trans\_t** **transA**, **const** NT \***alphap**, **const** NT \***Xp**, **rsb\_coo\_idx\_t** **incX**, **const** NT \***betap**, NT \***Yp**, **rsb\_coo\_idx\_t** **incY**) **const**\
 **RSBP\_RVT** **Err\_t** **spmv** (**rsb\_trans\_t** **transA**, **const** NT **alpha**, **const** NT \***Xp**, **rsb\_coo\_idx\_t** **incX**, **const** NT **beta**, NT \***Yp**, **rsb\_coo\_idx\_t** **incY**) **const**\
 **RSBP\_RVT** **Err\_t** **spmv** (**rsb\_trans\_t** **transA**, **const** NT **alpha**, **const** NT \***Xp**, **const** NT **beta**, NT \***Yp**) **const**\
 **RSBP\_RVT** **Err\_t** **spmv** (NT \***y**, **const** NT \***x**, **bool** **do\_trans**=**false**) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **spmm** (**rsb\_trans\_t** **transA**, **const** NT \***alphap**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***Bp**, **rsb\_nnz\_idx\_t** **ldB**, **const** NT \***betap**, NT \***Cp**, **rsb\_nnz\_idx\_t** **ldC**) **const**\
 **RSBP\_RVT** **Err\_t** **spmm** (**rsb\_trans\_t** **transA**, **const** NT **alpha**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***Bp**, **rsb\_nnz\_idx\_t** **ldB**, **const** NT **beta**, NT \***Cp**, **rsb\_nnz\_idx\_t** **ldC**) **const**\
 **RSBP\_RVT** **Err\_t** **spmm** (**rsb\_trans\_t** **transA**, **const** NT **alpha**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***Bp**, **const** NT **beta**, NT \***Cp**) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **spsm** (**rsb\_trans\_t** **transT**, **const** NT \***alphap**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***betap**, **const** NT \***Bp**, **rsb\_nnz\_idx\_t** **ldB**, NT \***Cp**, **rsb\_nnz\_idx\_t** **ldC**) **const**\
 **RSBP\_RVT** **Err\_t** **spsm** (**rsb\_trans\_t** **transT**, **const** NT **alpha**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT **beta**, **const** NT \***Bp**, **rsb\_nnz\_idx\_t** **ldB**, NT \***Cp**, **rsb\_nnz\_idx\_t** **ldC**) **const**\
 **RSBP\_RVT** **Err\_t** **spsm** (**rsb\_trans\_t** **transT**, **const** NT **alpha**, **rsb\_coo\_idx\_t** **nrhs**, **const** NT \***Bp**, NT \***Cp**) **const**\
 **RSBP\_RVT** **Err\_t** **spsm** (NT \***y**, **const** NT \***x**, **rsb\_coo\_idx\_t** **nrhs**, **bool** **do\_trans**=**false**) **const**\
 **RSBP\_RVT** **Err\_t** **spsm** (NT \***y**, **rsb\_coo\_idx\_t** **nrhs**, **bool** **do\_trans**=**false**) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **spsv** (**rsb\_trans\_t** **transT**, **const** NT \***alphap**, **const** NT \***Xp**, **rsb\_coo\_idx\_t** **incX**, NT \***Yp**, **rsb\_coo\_idx\_t** **incY**) **const**\
 **RSBP\_RVT** **Err\_t** **spsv** (**rsb\_trans\_t** **transT**, **const** NT **alpha**, **const** NT \***Xp**, NT \***Yp**) **const**\
 **RSBP\_RVT** **Err\_t** **spsv** (NT \***y**, **const** NT \***x**, **bool** **do\_trans**=**false**) **const**\
 **RSBP\_RVT** **Err\_t** **spsv** (NT \***y**, **bool** **do\_trans**=**false**) **const**\
 **size\_t** **get\_info\_size\_t** (**enum** **rsb\_mif\_t** **mif**) **const**\
 **rsb\_flags\_t** **get\_info\_rsb\_flags\_t** (**enum** **rsb\_mif\_t** **mif**) **const**\
 **rsb\_blk\_idx\_t** **get\_info\_blk\_t** (**enum** **rsb\_mif\_t** **mif**) **const**\
 **rsb\_nnz\_idx\_t** **get\_info\_nnz\_t** (**enum** **rsb\_mif\_t** **mif**) **const**\
 **rsb\_flags\_t** **get\_flags\_t** (**enum** **rsb\_mif\_t** **mif**) **const**\
 **rsb\_type\_t** **get\_type\_t** (**enum** **rsb\_mif\_t** **mif**) **const**\
 **rsb\_coo\_idx\_t** **get\_info\_coo\_t** (**enum** **rsb\_mif\_t** **mif**) **const**\
 **size\_t** **\_get\_index\_storage\_bytes** (**void**) **const**\
 **size\_t** **\_get\_storage\_bytes** (**void**) **const**\
 **rsb\_nnz\_idx\_t** **nnz** (**void**) **const**\
 **rsb\_blk\_idx\_t** **blocks** (**void**) **const**\
 **rsb\_coo\_idx\_t** **rows** (**void**) **const**\
 **rsb\_coo\_idx\_t** **cols** (**void**) **const**\
 **RSBP\_RVT** **Err\_t** **get\_vals** (NT \***VA**, **const** **rsb\_coo\_idx\_t** \***IA**, **const** **rsb\_coo\_idx\_t** \***JA**, **rsb\_nnz\_idx\_t** **nnz**, **rsb\_flags\_t** **flags**) **const**\
 NT **get\_val** (**const** **rsb\_coo\_idx\_t** **i**, **const** **rsb\_coo\_idx\_t** **j**, **rsb\_flags\_t** **flags**=**RSB\_FLAG\_NOFLAGS**) **const**\
 **RSBP\_RVT** **Err\_t** **set\_val** (**const** NT **val**, **const** **rsb\_coo\_idx\_t** **i**, **const** **rsb\_coo\_idx\_t** **j**, **rsb\_flags\_t** **flags**=**RSB\_FLAG\_NOFLAGS**)\
 **RSBP\_RVT** **Err\_t** **set\_vals** (**const** NT \***VA**, **const** **rsb\_coo\_idx\_t** \***IA**, **const** **rsb\_coo\_idx\_t** \***JA**, **rsb\_nnz\_idx\_t** **nnz**, **rsb\_flags\_t** **flags**)\
 **RSBP\_RVT** **Err\_t** **get\_vec** (NT \***Dp**, **enum** **rsb\_extff\_t** **flags**) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **get\_coo** (**rsb\_trans\_t** **transA**, NT \***VA**, **rsb\_coo\_idx\_t** \***IA**, **rsb\_coo\_idx\_t** \***JA**, **rsb\_flags\_t** **flags**) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **get\_csr** (**rsb\_trans\_t** **transA**, NT \***VA**, **rsb\_coo\_idx\_t** \***RP**, **rsb\_coo\_idx\_t** \***JA**, **rsb\_flags\_t** **flags**) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **get\_rows\_sparse** (**rsb\_trans\_t** **transA**, **const** NT \***alphap**, NT \***VA**, **rsb\_coo\_idx\_t** \***IA**, **rsb\_coo\_idx\_t** \***JA**, **rsb\_coo\_idx\_t** **frA**, **rsb\_coo\_idx\_t** **lrA**, **rsb\_nnz\_idx\_t** \***rnzp**, **rsb\_flags\_t** **flags**) **const**\
 **RSBP\_RVT** **Err\_t** **upd\_vals** (**enum** **rsb\_elopf\_t** **elop\_flags**, **const** NT &**omega**)\
 **RSBP\_RVT** **Err\_t** **upd\_vals** (**enum** **rsb\_elopf\_t** **elop\_flags**, **const** NT \***omegap**)\
 **RSBP\_RVT** **Err\_t** **get\_nrm** (NT \***Np**, **enum** **rsb\_extff\_t** **flags**) **const**\
 **rsb\_type\_t** **rsbtype** (**void**) **const**\
 **rsb\_flags\_t** **rsbflags** (**void**) **const**\
 **rsb\_string\_t** **get\_info\_str** (**const** **char** \***key**) **const**\
 **RSBP\_RVT** **Err\_t** **get\_info** (**enum** **rsb\_mif\_t** **miflags**, **void** \***minfop**) **const**\
 **rsb\_string\_t** **\_info** (**void**) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **tune\_spsm\_threads** (**rsb\_real\_t** \***sfp**=**RSBP\_NULL**, **rsb\_int\_t** \***tnp**=**RSBP\_NULL**, **rsb\_int\_t** **maxr**=0, **rsb\_time\_t** **maxt**=0, **rsb\_trans\_t** **transA**=**RSB\_TRANSPOSITION\_N**, **const** NT \***alphap**=**RSBP\_NULL**, **rsb\_coo\_idx\_t** **nrhs**=1, **rsb\_flags\_t** **order**=**RSB\_FLAG\_WANT\_COLUMN\_MAJOR\_ORDER**, **const** NT \***Bp**=**RSBP\_NULL**, **rsb\_nnz\_idx\_t** **ldB**=0, **const** NT \***betap**=**RSBP\_NULL**, NT \***Cp**=**RSBP\_NULL**, **rsb\_nnz\_idx\_t** **ldC**=0) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **tune\_spmm\_threads** (**rsb\_real\_t** \***sfp**=**RSBP\_NULL**, **rsb\_int\_t** \***tnp**=**RSBP\_NULL**, **rsb\_int\_t** **maxr**=0, **rsb\_time\_t** **maxt**=0, **rsb\_trans\_t** **transA**=**RSB\_TRANSPOSITION\_N**, **const** NT \***alphap**=**RSBP\_NULL**, **rsb\_coo\_idx\_t** **nrhs**=1, **rsb\_flags\_t** **order**=**RSB\_FLAG\_WANT\_COLUMN\_MAJOR\_ORDER**, **const** NT \***Bp**=**RSBP\_NULL**, **rsb\_nnz\_idx\_t** **ldB**=0, **const** NT \***betap**=**RSBP\_NULL**, NT \***Cp**=**RSBP\_NULL**, **rsb\_nnz\_idx\_t** **ldC**=0) **const**\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **tune\_spmm** (**rsb\_real\_t** \***sfp**, **rsb\_int\_t** \***tnp**, **rsb\_int\_t** **maxr**, **rsb\_time\_t** **maxt**, **rsb\_trans\_t** **transA**, **const** NT \***alphap**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***Bp**, **rsb\_nnz\_idx\_t** **ldB**, **const** NT \***betap**, NT \***Cp**, **rsb\_nnz\_idx\_t** **ldC**)\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **tune\_spmm** (**rsb\_real\_t** \***sfp**, **rsb\_int\_t** \***tnp**, **rsb\_int\_t** **maxr**, **rsb\_time\_t** **maxt**, **rsb\_trans\_t** **transA**, **const** NT **alpha**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***Bp**, **rsb\_nnz\_idx\_t** **ldB**, **const** NT **beta**, NT \***Cp**, **rsb\_nnz\_idx\_t** **ldC**)\
 **RSBP\_RVT** **Err\_t** **tune\_spmm** (**rsb\_real\_t** &**sf**, **rsb\_trans\_t** **transA**, **const** NT **alpha**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***Bp**, **const** NT **beta**, NT \***Cp**)\
 **RSBP\_RVT** **RSBP\_DEPRECATED** **Err\_t** **tune\_spsm** (**rsb\_real\_t** \***sfp**, **rsb\_int\_t** \***tnp**, **rsb\_int\_t** **maxr**, **rsb\_time\_t** **maxt**, **rsb\_trans\_t** **transA**, **const** NT \***alphap**, **rsb\_coo\_idx\_t** **nrhs**, **rsb\_flags\_t** **order**, **const** NT \***Bp**, **rsb\_nnz\_idx\_t** **ldB**, **const** NT \***betap**, NT \***Cp**, **rsb\_nnz\_idx\_t** **ldC**)\
 **RSBP\_RVT** **Err\_t** **file\_save** (**const** **rsb\_char\_t** \***filename**=**RSBP\_NULL**) **const**\
 **RsbMatrix** & **operator=** (**const** **RsbMatrix** &**A\_Rsb**)\
 **bool** **\_is\_complex** (**void**) **const**\
 **bool** **operator==** (**const** **RsbMatrix** &**B\_Rsb**) **const**\
 **bool** **operator!=** (**const** **RsbMatrix** &**B\_Rsb**) **const**\
 NT **normOne** (**void**) **const**\
 NT **normInf** (**void**) **const**\
 **RSBP\_RVT** **Err\_t** **rndr** (**const** **rsb\_char\_t** \***filename**=**RSBP\_NULL**, **rsb\_coo\_idx\_t** **pmWidth**=512, **rsb\_coo\_idx\_t** **pmHeight**=512, **rsb\_marf\_t** **rflags**=**RSB\_MARF\_EPS**) **const**\

## Detailed Description

### template\<RSBP\_Scalar\_t NT\>

class RsbMatrix\< NT \>"Represent a sparse matrix in RSB format by means of `librsb`.

Manage construction, destruction, and std::move of numerical matrices. \
 Most of the member functions here translate directly to a single function call to `librsb` (**rsb.h), and pass the parameters as they are, so the error checking is done by** `librsb`**.** \
 **While most of** `librsb` `C` **functions use** `void*` **pointers instead of numerical data, RsbMatrix is templated by a type parameter. This introduces type safety at compile time.**

**Users of member functions can choose among several overloads. So in additional to the more direct overloads passing e.g. $ alpha $ and $ beta $ by reference, here a user can pass them by value.**

**Parameters**

*NT* **the numerical type, at least for the four canonical ones (**`float`**,** `double`**,** `std::complex<float>`**,** `std::complex<double>`**); see matrix\_supported\_numerical\_types\_section and rsb\_type\_t for more.**

**Note**

**Default error propagation is by exception throw for all constructors and most member functions.** \
 **Functions declared to return Err\_t can be specialized in rsb\_err\_t so not to throw exceptions, but to return an error code instead.** \
 **Exceptions thrown by member functions (not constructors) can be deactivated at build time by defining RSBP\_NOTHROW before including** `<`**rsb.hpp**`>`**.**

**One may turn on return error value as default at build time by defining RSBP\_WANT\_REV=1 .**

**Warning**

**The error model is work in progress and subject to change.**

**Todo**

**While the rsb.h interface is stable, the rsb.hpp interface is neither stable, nor complete: early users' feedback is very welcome.** \
 **Shall all $ alpha $ and $ beta $ be passed by values only? This is natural and fits C++. But rsb\_tune\_spmm() / rsb\_tune\_spsm() have more parameters with a nullptr-like \`default' value: how to deal with them in RsbMatrix::tune\_spmm() / RsbMatrix::tune\_spsm() without introducing too many special cases ?** \
 **Similarly for the consistency of RsbMatrix::get\_flags\_t(), RsbMatrix::get\_type\_t(), RsbMatrix::get\_info\_coo\_t(), and similar: shall they throw an exception if given a flag not matching the return type ?** \
 **Or maybe keeping only RsbMatrix::get\_info(), with per-type reference overloads ?** \
 **Furthermore: if working under C++20, shall RsbLib avoid pointer-based interfaces completely (using** `std::span` **only)?**

## Member Enumeration Documentation

### template\<RSBP\_Scalar\_t NT\> enum RsbMatrix::RsbSym

**Matrix structure: either general, symmetric, hermitian, or triangular (also see rsb\_flags\_t).**

**Enumerator**

- *IsGen*

  *General matrix, no triangle structure or symmetry assumed.*

- *IsHer*

  *Hermitian ( $ A == A^H $). Please pass only lower/upper triangle.*

- *IsSym*

  *Symmetric ( $ A == A^T $). Please pass only lower/upper triangle.*

- *IsTri*

  *Triangular (required for* **spsv/** *spsm).*

## Constructor & Destructor Documentation

### template\<RSBP\_Scalar\_t NT\> RsbMatrix\< NT \>::RsbMatrix (rsb\_coo\_idx\_t nrA, rsb\_coo\_idx\_t ncA, const RsbSym sym = IsGen)` [inline]`

*Begin assembling a sparse matrix of given dimensions and type.* \
 *Then you can use* **set\_val()** *or* **set\_vals()** *repeatedly to populate the matrix.* \
 *After populating the matrix, use* **close()** *to terminate its assembly.* \
\
  *Example snip from* **examples/assemble.cpp***:*

```
  const rsb_coo_idx_t nrA { 4 }, ncA { 4 };
  RsbMatrix<double> mtx(nrA,ncA); // begin matrix assembly
  // insert elements of a tridiagonal matrix, one by one
  for (auto i = 0; i < nrA; ++i )
    for (auto j = i-1; j <= i+1; ++j )
      if ( i >= 0 && i < nrA )
        if ( j >= 0 && j < ncA )
          mtx.set_val((i+1)*100+(j+1),i,j); // add entry
  mtx.close(); // finish matrix assembly
  assert(mtx.nnz() == 3 * nrA - 2);
```

**Note**

*Directly based on C function* **rsb\_mtx\_alloc\_from\_coo\_begin()** *from* `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RsbMatrix\< NT \>::RsbMatrix (rsb\_coo\_idx\_t nrA, const rsb\_coo\_idx\_t \* RP, const rsb\_coo\_idx\_t \* JA, const NT \* VA, const RsbSym sym = IsGen)` [inline]`

**Assemble a sparse matrix given CSR input.** \
 **Note**

**Directly based on C function rsb\_mtx\_alloc\_from\_csr\_const() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RsbMatrix\< NT \>::RsbMatrix (const rsb\_coo\_idx\_t \* IA, const rsb\_coo\_idx\_t \* JA, const NT \* VA, rsb\_nnz\_idx\_t nnzA, const rsb\_flags\_t flagsA = RSB\_FLAG\_NOFLAGS)` [inline]`

**Assemble a sparse matrix given COO input.** \
 **Example snip from examples/misc.cpp:**

```
    const rsb_nnz_idx_t nnzA { 7 };
    const rsb_coo_idx_t nrA { 6 }, ncA { 6 }, nrhs { 1 };
    const std::vector<rsb_coo_idx_t> IA {0,1,2,3,4,5,1}, JA {0,1,2,3,4,5,0};
    const std::vector<double> VA {1,1,1,1,1,1,2}, X(ncA,1);
    RsbMatrix<double> mtx(IA.data(),JA.data(),VA.data(),nnzA);
```

**Note**

**Directly based on C function rsb\_mtx\_alloc\_from\_coo\_const() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RsbMatrix\< NT \>::RsbMatrix (const rsb\_char\_t \* filename, const RsbSym sym = IsGen)` [inline]`

**Assemble a sparse matrix given filename input.** \
 **Note**

**Directly based on C function rsb\_file\_mtx\_load() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RsbMatrix\< NT \>::RsbMatrix (const RsbMatrix\< NT \> & A\_Rsb, bool do\_trans = false, rsb\_flags\_t flagsA = RSB\_FLAG\_NOFLAGS)` [inline]`

**Copy a sparse matrix given example input.** \
 **Can either clone it, or transpose it or change flags (structure) in the process.**

### template\<RSBP\_Scalar\_t NT\> RsbMatrix\< NT \>::RsbMatrix (RsbMatrix\< NT \> && other)` [inline]`

**Move constructor.** \
 **The moved matrix object will be invalid afterwards.** \
 **Example snip from examples/misc.cpp:**

```
  assert( mtx1.nnz() == nnzA );
  RsbMatrix<double> mtx3 { std::move(mtx1) };
  assert( mtx3.nnz() == nnzA );
```

### template\<RSBP\_Scalar\_t NT\> RsbMatrix\< NT \>::~RsbMatrix (void)` [inline]`

**Destructor.** \
 **Frees matrix object memory.** \
 **Note**

**Directly based on C function rsb\_mtx\_free() from** `<`**rsb.h**`>`**.**

## Member Function Documentation

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::\_add (rsb\_coo\_idx\_t i, rsb\_coo\_idx\_t j, NT val)` [inline]`

**Deprecated**

**Use set\_val() and set\_vals() instead.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::\_close (void)` [inline]`

**Deprecated**

**Use close() instead.**

### template\<RSBP\_Scalar\_t NT\> size\_t RsbMatrix\< NT \>::\_get\_index\_storage\_bytes (void) const` [inline]`

**Warning**

**The name of this member function is expected to change.**

### template\<RSBP\_Scalar\_t NT\> size\_t RsbMatrix\< NT \>::\_get\_storage\_bytes (void) const` [inline]`

**Warning**

**The name of this member function is expected to change.**

### template\<RSBP\_Scalar\_t NT\> rsb\_string\_t RsbMatrix\< NT \>::\_info (void) const` [inline]`

**Warning**

**The name of this member function is expected to change.**

### template\<RSBP\_Scalar\_t NT\> bool RsbMatrix\< NT \>::\_is\_complex (void) const` [inline]`

**Warning**

**The name of this member function is expected to change.**

### template\<RSBP\_Scalar\_t NT\> rsb\_blk\_idx\_t RsbMatrix\< NT \>::blocks (void) const` [inline]`

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::close (void)` [inline]`

**Terminate assembly of a previously started and populated matrix.** \
 **Shall be called once.**

**Example snip from examples/assemble.cpp:**

```
  const rsb_coo_idx_t nrA { 4 }, ncA { 4 };
  RsbMatrix<double> mtx(nrA,ncA); // begin matrix assembly
  // insert elements of a tridiagonal matrix, one by one
  for (auto i = 0; i < nrA; ++i )
    for (auto j = i-1; j <= i+1; ++j )
      if ( i >= 0 && i < nrA )
        if ( j >= 0 && j < ncA )
          mtx.set_val((i+1)*100+(j+1),i,j); // add entry
  mtx.close(); // finish matrix assembly
  assert(mtx.nnz() == 3 * nrA - 2);
```

**See also**

**RsbMatrix::RsbMatrix(rsb\_coo\_idx\_t nrA, rsb\_coo\_idx\_t ncA, const RsbSym sym = IsGen );**

**Note**

**Directly based on C function rsb\_mtx\_alloc\_from\_coo\_end() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> rsb\_coo\_idx\_t RsbMatrix\< NT \>::cols (void) const` [inline]`

**Example snip from examples/twonnz.cpp:**

```
        std::cout << "# Matrix sized " << mtx.rows() << "x" << mtx.cols() << ", " << nnzA << " nnz  built in " << dt << " s and occupies " << mtxocc << " bytes " << std::endl;
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::file\_save (const rsb\_char\_t \* filename = RSBP\_NULL) const` [inline]`

**Note**

**Directly based on C function rsb\_file\_mtx\_save() from** `<`**rsb.h**`>`**.**

**Example snip from examples/misc.cpp:**

```
    mtx.file_save(); // print to stdout
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::get\_coo (rsb\_trans\_t transA, NT \* VA, rsb\_coo\_idx\_t \* IA, rsb\_coo\_idx\_t \* JA, rsb\_flags\_t flags) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_coo() from** `<`**rsb.h**`>`**.**

**Warning**

**Only** `transA=RSB_TRANSPOSITION_N` **currently supported.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::get\_csr (rsb\_trans\_t transA, NT \* VA, rsb\_coo\_idx\_t \* RP, rsb\_coo\_idx\_t \* JA, rsb\_flags\_t flags) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_csr() from** `<`**rsb.h**`>`**.**

**Warning**

**Only** `transA=RSB_TRANSPOSITION_N` **currently supported.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> rsb\_flags\_t RsbMatrix\< NT \>::get\_flags\_t (enum rsb\_mif\_t mif) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::get\_info (enum rsb\_mif\_t miflags, void \* minfop) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> rsb\_blk\_idx\_t RsbMatrix\< NT \>::get\_info\_blk\_t (enum rsb\_mif\_t mif) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> rsb\_coo\_idx\_t RsbMatrix\< NT \>::get\_info\_coo\_t (enum rsb\_mif\_t mif) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> rsb\_nnz\_idx\_t RsbMatrix\< NT \>::get\_info\_nnz\_t (enum rsb\_mif\_t mif) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> rsb\_flags\_t RsbMatrix\< NT \>::get\_info\_rsb\_flags\_t (enum rsb\_mif\_t mif) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> size\_t RsbMatrix\< NT \>::get\_info\_size\_t (enum rsb\_mif\_t mif) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> rsb\_string\_t RsbMatrix\< NT \>::get\_info\_str (const char \* key) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info\_str() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::get\_nrm (NT \* Np, enum rsb\_extff\_t flags) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_nrm() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::get\_rows\_sparse (rsb\_trans\_t transA, const NT \* alphap, NT \* VA, rsb\_coo\_idx\_t \* IA, rsb\_coo\_idx\_t \* JA, rsb\_coo\_idx\_t frA, rsb\_coo\_idx\_t lrA, rsb\_nnz\_idx\_t \* rnzp, rsb\_flags\_t flags) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_rows\_sparse() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> rsb\_type\_t RsbMatrix\< NT \>::get\_type\_t (enum rsb\_mif\_t mif) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_info() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> NT RsbMatrix\< NT \>::get\_val (const rsb\_coo\_idx\_t i, const rsb\_coo\_idx\_t j, rsb\_flags\_t flags = RSB\_FLAG\_NOFLAGS) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_vals() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::get\_vals (NT \* VA, const rsb\_coo\_idx\_t \* IA, const rsb\_coo\_idx\_t \* JA, rsb\_nnz\_idx\_t nnz, rsb\_flags\_t flags) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_vals() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::get\_vec (NT \* Dp, enum rsb\_extff\_t flags) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_get\_vec() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> rsb\_nnz\_idx\_t RsbMatrix\< NT \>::nnz (void) const` [inline]`

### template\<RSBP\_Scalar\_t NT\> NT RsbMatrix\< NT \>::normInf (void) const` [inline]`

### template\<RSBP\_Scalar\_t NT\> NT RsbMatrix\< NT \>::normOne (void) const` [inline]`

### template\<RSBP\_Scalar\_t NT\> bool RsbMatrix\< NT \>::operator!= (const RsbMatrix\< NT \> & B\_Rsb) const` [inline]`

**Example snip from examples/misc.cpp:**

```
  assert(   mtx1 == mtx2  );
  assert( !(mtx1 != mtx2) );
```

**See also**

**RsbMatrix::operator==(const RsbMatrix & B\_Rsb) const;**

### template\<RSBP\_Scalar\_t NT\> RsbMatrix & RsbMatrix\< NT \>::operator= (const RsbMatrix\< NT \> & A\_Rsb)` [inline]`

**A copy constructor. Will clone the input matrix contents.**

### template\<RSBP\_Scalar\_t NT\> bool RsbMatrix\< NT \>::operator== (const RsbMatrix\< NT \> & B\_Rsb) const` [inline]`

**Deep comparison: compare if the two matrices have same dimensions, nonzeroes count, nonzeroes pattern and value. Meant for very sporadic use. Inefficient: it can involve matrices copying.**

**Example snip from examples/misc.cpp:**

```
  assert(   mtx1 == mtx2  );
  assert( !(mtx1 != mtx2) );
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::rndr (const rsb\_char\_t \* filename = RSBP\_NULL, rsb\_coo\_idx\_t pmWidth = `512`, rsb\_coo\_idx\_t pmHeight = `512`, rsb\_marf\_t rflags = RSB\_MARF\_EPS) const` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_rndr() from** `<`**rsb.h**`>`**.**

**Example snip from examples/render.cpp:**

```
                mtx.rndr(psfilename.c_str());
```

### template\<RSBP\_Scalar\_t NT\> rsb\_coo\_idx\_t RsbMatrix\< NT \>::rows (void) const` [inline]`

**Example snip from examples/twonnz.cpp:**

```
        std::cout << "# Matrix sized " << mtx.rows() << "x" << mtx.cols() << ", " << nnzA << " nnz  built in " << dt << " s and occupies " << mtxocc << " bytes " << std::endl;
```

### template\<RSBP\_Scalar\_t NT\> rsb\_flags\_t RsbMatrix\< NT \>::rsbflags (void) const` [inline]`

### template\<RSBP\_Scalar\_t NT\> rsb\_type\_t RsbMatrix\< NT \>::rsbtype (void) const` [inline]`

**Example snip from examples/twonnz.cpp:**

```
                std::cout << "# type=" << mtx.rsbtype() << " nt=1," << rnt << " n=" << n << " nrhs=" << nrhs << " order=" << oc << " alpha=" << alpha << " beta=" << beta << " dt=" << dta[0] << ".." << dta[1] << " spmm-scalability=" << dta[0]/dta[1] << " nnz/s=" << nnzA/dta[0] << ".." << nnzA/dta[1] << " flops=" << flops_c/dta[0] << ".." << flops_c/dta[1] << " occ.=" << opocc << " " << std::endl;
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::set\_val (const NT val, const rsb\_coo\_idx\_t i, const rsb\_coo\_idx\_t j, rsb\_flags\_t flags = RSB\_FLAG\_NOFLAGS)` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_set\_vals() from** `<`**rsb.h**`>`**.**

**Example snip from examples/assemble.cpp:**

```
  const rsb_coo_idx_t nrA { 4 }, ncA { 4 };
  RsbMatrix<double> mtx(nrA,ncA); // begin matrix assembly
  // insert elements of a tridiagonal matrix, one by one
  for (auto i = 0; i < nrA; ++i )
    for (auto j = i-1; j <= i+1; ++j )
      if ( i >= 0 && i < nrA )
        if ( j >= 0 && j < ncA )
          mtx.set_val((i+1)*100+(j+1),i,j); // add entry
  mtx.close(); // finish matrix assembly
  assert(mtx.nnz() == 3 * nrA - 2);
```

**See also**

**set\_vals().**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::set\_vals (const NT \* VA, const rsb\_coo\_idx\_t \* IA, const rsb\_coo\_idx\_t \* JA, rsb\_nnz\_idx\_t nnz, rsb\_flags\_t flags)` [inline]`

**Add a single entry during the assembly of a matrix created empty.** \
 **Use close() to terminate matrix assembly.**

**Example snip from examples/assemble.cpp:**

```
  const rsb_coo_idx_t nrA { 4 }, ncA { 4 };
  RsbMatrix<double> mtx(nrA,ncA); // begin matrix assembly
  // insert elements of a tridiagonal matrix, one by one
  for (auto i = 0; i < nrA; ++i )
    for (auto j = i-1; j <= i+1; ++j )
      if ( i >= 0 && i < nrA )
        if ( j >= 0 && j < ncA )
          mtx.set_val((i+1)*100+(j+1),i,j); // add entry
  mtx.close(); // finish matrix assembly
  assert(mtx.nnz() == 3 * nrA - 2);
```

**Note**

**Directly based on C function rsb\_mtx\_set\_vals() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::spmm (rsb\_trans\_t transA, const NT \* alphap, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* Bp, rsb\_nnz\_idx\_t ldB, const NT \* betap, NT \* Cp, rsb\_nnz\_idx\_t ldC) const` [inline]`

**Note**

**Directly based on C function rsb\_spmm() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spmm (rsb\_trans\_t transA, const NT alpha, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* Bp, const NT beta, NT \* Cp) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spmm() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spmm (rsb\_trans\_t transA, const NT alpha, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* Bp, rsb\_nnz\_idx\_t ldB, const NT beta, NT \* Cp, rsb\_nnz\_idx\_t ldC) const` [inline]`

**Example snip from examples/bench.cpp:**

```
                        mtx.spmm(transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC);
```

**Note**

**Indirectly based on C function rsb\_spmm() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spmv (NT \* y, const NT \* x, bool do\_trans = false) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spmv() from** `<`**rsb.h**`>`**.**

**Example snip from examples/span.cpp:**

```
  mtx.tune_spmm(nullptr,&tn,0,0.0,RSB_TRANSPOSITION_N,alpha,nrhs,RSB_FLAG_WANT_COLUMN_MAJOR_ORDER,X,ncA,beta,Y,nrA);
  mtx.spmv(RSB_TRANSPOSITION_N, alpha, X, beta, Y);
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::spmv (rsb\_trans\_t transA, const NT \* alphap, const NT \* Xp, rsb\_coo\_idx\_t incX, const NT \* betap, NT \* Yp, rsb\_coo\_idx\_t incY) const` [inline]`

**Note**

**Directly based on C function rsb\_spmv() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spmv (rsb\_trans\_t transA, const NT alpha, const NT \* Xp, const NT beta, NT \* Yp) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spmv() from** `<`**rsb.h**`>`**.**

**Example snip from examples/span.cpp:**

```
  mtx.tune_spmm(nullptr,&tn,0,0.0,RSB_TRANSPOSITION_N,alpha,nrhs,RSB_FLAG_WANT_COLUMN_MAJOR_ORDER,X,ncA,beta,Y,nrA);
  mtx.spmv(RSB_TRANSPOSITION_N, alpha, X, beta, Y);
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spmv (rsb\_trans\_t transA, const NT alpha, const NT \* Xp, rsb\_coo\_idx\_t incX, const NT beta, NT \* Yp, rsb\_coo\_idx\_t incY) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spmv() from** `<`**rsb.h**`>`**.**

**Example snip from examples/span.cpp:**

```
  mtx.tune_spmm(nullptr,&tn,0,0.0,RSB_TRANSPOSITION_N,alpha,nrhs,RSB_FLAG_WANT_COLUMN_MAJOR_ORDER,X,ncA,beta,Y,nrA);
  mtx.spmv(RSB_TRANSPOSITION_N, alpha, X, beta, Y);
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spsm (NT \* y, const NT \* x, rsb\_coo\_idx\_t nrhs, bool do\_trans = false) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spsm() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spsm (NT \* y, rsb\_coo\_idx\_t nrhs, bool do\_trans = false) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spsm() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::spsm (rsb\_trans\_t transT, const NT \* alphap, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* betap, const NT \* Bp, rsb\_nnz\_idx\_t ldB, NT \* Cp, rsb\_nnz\_idx\_t ldC) const` [inline]`

**Note**

**Directly based on C function rsb\_spsm() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spsm (rsb\_trans\_t transT, const NT alpha, rsb\_coo\_idx\_t nrhs, const NT \* Bp, NT \* Cp) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spsm() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spsm (rsb\_trans\_t transT, const NT alpha, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT beta, const NT \* Bp, rsb\_nnz\_idx\_t ldB, NT \* Cp, rsb\_nnz\_idx\_t ldC) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spsm() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spsv (NT \* y, bool do\_trans = false) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spsv() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spsv (NT \* y, const NT \* x, bool do\_trans = false) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spsv() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::spsv (rsb\_trans\_t transT, const NT \* alphap, const NT \* Xp, rsb\_coo\_idx\_t incX, NT \* Yp, rsb\_coo\_idx\_t incY) const` [inline]`

**Note**

**Directly based on C function rsb\_spsv() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::spsv (rsb\_trans\_t transT, const NT alpha, const NT \* Xp, NT \* Yp) const` [inline]`

**Note**

**Indirectly based on C function rsb\_spsv() from** `<`**rsb.h**`>`**.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::tune\_spmm (rsb\_real\_t & sf, rsb\_trans\_t transA, const NT alpha, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* Bp, const NT beta, NT \* Cp)` [inline]`

**Note**

**Indirectly based on C function rsb\_tune\_spmm() from** `<`**rsb.h**`>`**.**

**Example snip from examples/autotune.cpp:**

```
                        tt = -rsb_time();
                        mtx.tune_spmm(&sf,&tn,maxr,tmax,transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC);
                        tt += rsb_time();
                        auto nnsmA {mtx.blocks()};
                        std::cout << "Tuning took " << tt << " s ( " << tt / dt << " ops ) and changed " << nsmA << " to " << nnsmA << " blocks" << std::endl;
                        mtx.spmm(transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC); // caches warmup
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::tune\_spmm (rsb\_real\_t \* sfp, rsb\_int\_t \* tnp, rsb\_int\_t maxr, rsb\_time\_t maxt, rsb\_trans\_t transA, const NT \* alphap, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* Bp, rsb\_nnz\_idx\_t ldB, const NT \* betap, NT \* Cp, rsb\_nnz\_idx\_t ldC)` [inline]`

**Note**

**Directly based on C function rsb\_tune\_spmm() from** `<`**rsb.h**`>`**.**

**Example snip from examples/autotune.cpp:**

```
                        tt = -rsb_time();
                        mtx.tune_spmm(&sf,&tn,maxr,tmax,transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC);
                        tt += rsb_time();
                        auto nnsmA {mtx.blocks()};
                        std::cout << "Tuning took " << tt << " s ( " << tt / dt << " ops ) and changed " << nsmA << " to " << nnsmA << " blocks" << std::endl;
                        mtx.spmm(transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC); // caches warmup
```

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::tune\_spmm (rsb\_real\_t \* sfp, rsb\_int\_t \* tnp, rsb\_int\_t maxr, rsb\_time\_t maxt, rsb\_trans\_t transA, const NT alpha, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* Bp, rsb\_nnz\_idx\_t ldB, const NT beta, NT \* Cp, rsb\_nnz\_idx\_t ldC)` [inline]`

**Note**

**Indirectly based on C function rsb\_tune\_spmm() from** `<`**rsb.h**`>`**.**

**Example snip from examples/autotune.cpp:**

```
                        tt = -rsb_time();
                        mtx.tune_spmm(&sf,&tn,maxr,tmax,transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC);
                        tt += rsb_time();
                        auto nnsmA {mtx.blocks()};
                        std::cout << "Tuning took " << tt << " s ( " << tt / dt << " ops ) and changed " << nsmA << " to " << nnsmA << " blocks" << std::endl;
                        mtx.spmm(transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC); // caches warmup
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::tune\_spmm\_threads (rsb\_real\_t \* sfp = RSBP\_NULL, rsb\_int\_t \* tnp = RSBP\_NULL, rsb\_int\_t maxr = `0`, rsb\_time\_t maxt = `0`, rsb\_trans\_t transA = RSB\_TRANSPOSITION\_N, const NT \* alphap = RSBP\_NULL, rsb\_coo\_idx\_t nrhs = `1`, rsb\_flags\_t order = RSB\_FLAG\_WANT\_COLUMN\_MAJOR\_ORDER, const NT \* Bp = RSBP\_NULL, rsb\_nnz\_idx\_t ldB = `0`, const NT \* betap = RSBP\_NULL, NT \* Cp = RSBP\_NULL, rsb\_nnz\_idx\_t ldC = `0`) const` [inline]`

**Note**

**Directly based on C function rsb\_tune\_spmm() from** `<`**rsb.h**`>`**.**

**Example snip from examples/autotune.cpp:**

```
                        tt = -rsb_time();
                        mtx.tune_spmm(&sf,&tn,maxr,tmax,transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC);
                        tt += rsb_time();
                        auto nnsmA {mtx.blocks()};
                        std::cout << "Tuning took " << tt << " s ( " << tt / dt << " ops ) and changed " << nsmA << " to " << nnsmA << " blocks" << std::endl;
                        mtx.spmm(transA,&alpha,nrhs,order,B.data(),ldB,&beta,C.data(),ldC); // caches warmup
```

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::tune\_spsm (rsb\_real\_t \* sfp, rsb\_int\_t \* tnp, rsb\_int\_t maxr, rsb\_time\_t maxt, rsb\_trans\_t transA, const NT \* alphap, rsb\_coo\_idx\_t nrhs, rsb\_flags\_t order, const NT \* Bp, rsb\_nnz\_idx\_t ldB, const NT \* betap, NT \* Cp, rsb\_nnz\_idx\_t ldC)` [inline]`

**Note**

**Directly based on C function rsb\_tune\_spsm() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT RSBP\_DEPRECATED Err\_t RsbMatrix\< NT \>::tune\_spsm\_threads (rsb\_real\_t \* sfp = RSBP\_NULL, rsb\_int\_t \* tnp = RSBP\_NULL, rsb\_int\_t maxr = `0`, rsb\_time\_t maxt = `0`, rsb\_trans\_t transA = RSB\_TRANSPOSITION\_N, const NT \* alphap = RSBP\_NULL, rsb\_coo\_idx\_t nrhs = `1`, rsb\_flags\_t order = RSB\_FLAG\_WANT\_COLUMN\_MAJOR\_ORDER, const NT \* Bp = RSBP\_NULL, rsb\_nnz\_idx\_t ldB = `0`, const NT \* betap = RSBP\_NULL, NT \* Cp = RSBP\_NULL, rsb\_nnz\_idx\_t ldC = `0`) const` [inline]`

**Note**

**Directly based on C function rsb\_tune\_spsm() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::upd\_vals (enum rsb\_elopf\_t elop\_flags, const NT & omega)` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_upd\_vals() from** `<`**rsb.h**`>`**.**

**Example snip from examples/bench.cpp:**

```
        mtx.upd_vals(RSB_ELOPF_POW,nt_t{0.0}); // set matrix values to ones
```

### template\<RSBP\_Scalar\_t NT\> RSBP\_RVT Err\_t RsbMatrix\< NT \>::upd\_vals (enum rsb\_elopf\_t elop\_flags, const NT \* omegap)` [inline]`

**Note**

**Directly based on C function rsb\_mtx\_upd\_vals() from** `<`**rsb.h**`>`**.**

**Deprecated**

**This function overload is deprecated: use the corresponding overload without the C-style pointers-to-scalar, or request one if non existing yet.**

## Author

**Generated automatically by Doxygen for librsb from the source code.**
