arb/fmprb_mat/init.c

47 lines
1.5 KiB
C
Raw Normal View History

2012-09-26 14:19:13 +02:00
/*=============================================================================
This file is part of ARB.
ARB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
ARB 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with ARB; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=============================================================================*/
/******************************************************************************
Copyright (C) 2012 Fredrik Johansson
******************************************************************************/
#include "fmprb_mat.h"
void
fmprb_mat_init(fmprb_mat_t mat, long r, long c)
{
if (r != 0 && c != 0)
{
long i;
mat->entries = _fmprb_vec_init(r * c);
mat->rows = (fmprb_ptr *) flint_malloc(r * sizeof(fmprb_ptr));
2012-09-26 14:19:13 +02:00
for (i = 0; i < r; i++)
mat->rows[i] = mat->entries + i * c;
}
else
mat->entries = NULL;
mat->r = r;
mat->c = c;
}