2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2014 - Scilab Enterprises - Cedric Delamarre
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
17 #include "elem_common.h"
19 // converted a matrix of polynom to a polynomial matrix
20 double* dmp2pm(double** _pdblMP, int _iSizeMP, int* _piRanks, int _iMaxRank)
27 iSizePM = _iSizeMP * (_iMaxRank + 1);
28 pdblPM = (double*)malloc(iSizePM * sizeof(double));
29 memset(pdblPM, 0x00, iSizePM * sizeof(double));
31 if (_piRanks == NULL || _iMaxRank == 0)
33 // shortcut in case where pdblMP come from a types::Double
34 // a matrix of double considered as a polynomial of degree zero
35 C2F(dcopy)(&_iSizeMP, _pdblMP[0], &iOne, pdblPM, &iOne);
37 else if (_iSizeMP == 1)
39 // shortcut in case where pdblMP is scalar polynom
40 int iSize = _piRanks[0] + 1;
41 C2F(dcopy)(&iSize, _pdblMP[0], &iOne, pdblPM, &iOne);
45 for (i = 0; i < _iSizeMP; i++)
47 int iSize = _piRanks[i] + 1;
48 C2F(dcopy)(&iSize, _pdblMP[i], &iOne, pdblPM + i, &_iSizeMP);