/*
Copyright (C) 2008-2020 Michele Martone
This file is part of librsb.
librsb is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
librsb is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with librsb; see the file COPYING.
If not, see .
*/
/*!
@file
@author Michele Martone
@brief A toy program showing instantiation, transposition and other
operations on a single matrix.
\ingroup rsb_doc_examples
\include transpose.c
*/
#include
#include /* printf */
int main(const int argc, char * const argv[])
{
struct rsb_mtx_t *mtxAp = NULL;
rsb_blk_idx_t brA = RSB_DEFAULT_BLOCKING, bcA=RSB_DEFAULT_BLOCKING;
rsb_err_t errval = RSB_ERR_NO_ERROR;
rsb_nnz_idx_t nnzA = 1;
rsb_coo_idx_t nrA = 1;
rsb_coo_idx_t ncA = 1;
rsb_coo_idx_t IA[] = { 0 };
rsb_coo_idx_t JA[] = { 0 };
RSB_DEFAULT_TYPE VA[] = { 1 };
rsb_type_t typecode = RSB_NUMERICAL_TYPE_DEFAULT;
/* library initialization */
if(rsb_lib_init(RSB_NULL_INIT_OPTIONS)!=RSB_ERR_NO_ERROR)
{
return -1;
}
/* allocation */
mtxAp = rsb_mtx_alloc_from_coo_const(
VA,IA,JA,nnzA,typecode,nrA,ncA,
brA,bcA,RSB_FLAG_NOFLAGS,NULL);
if(!mtxAp)
{
return -1;
}
errval = rsb_mtx_rndr("crash.eps", mtxAp, 1024, 1024, RSB_MARF_EPS);
if( RSB_ERR_NO_ERROR != errval )
{
goto err;
}
rsb_mtx_free(mtxAp);
if(RSB_ERR_NO_ERROR != rsb_lib_exit(RSB_NULL_EXIT_OPTIONS))
{
goto err;
}
printf("OK\n");
return 0;
err:
rsb_perror(NULL,errval);
return -1;
}