55 for(
int i=0; i<matA.GetRows(); ++i )
64 for(
int i=0; i<int(matA.GetRows()); ++i )
79 NekMatrix<NekDouble>
Invert(
const NekMatrix<NekDouble> & matA)
81 int rows = matA.GetRows(), columns = matA.GetColumns();
82 NekMatrix<NekDouble> matX(rows,columns);
88 for(
int j=0; j<columns; ++j )
96 NekMatrix<NekDouble>
GetTranspose(
const NekMatrix<NekDouble> & matA)
98 int rows = matA.GetRows(), columns = matA.GetColumns();
99 NekMatrix<NekDouble> matX(rows,columns);
101 for(
int i=0; i<rows; ++i )
103 for(
int j=0; j<columns; ++j )
105 matX(j,i) = matA(i,j);
111 int GetSize(
const ConstArray<OneD, NekDouble> & x)
113 return x.num_elements();
136 for(
int i=0; i<size; ++i )
148 for(
int i=0; i<size; ++i )
150 z[i] = pow( x[i], p );
160 s << setprecision(precision);
161 int M = int(A.GetRows()), N =
int(A.GetColumns());
163 for(
int i=0; i<M; ++i )
165 for(
int j=0; j<N; ++j)
168 s << setw(7) << right << a;
186 s << setprecision(precision) <<
"[ ";
188 for(
int j=0; j<N; ++j )
191 s << setw(7) << right << x;
204 return (degree+1) * (degree+2) / 2;
209 int degree = int(
MakeRound((-3.0 + sqrt(1.0 + 8.0*nBasisFunctions))/2.0));
212 ASSERTL1(
GetTriNumPoints(degree) == nBasisFunctions,
"The number of points defines an expansion of fractional degree, which is not supported." );
218 return (degree+1) * (degree+2) * (degree+3) / 6;
224 NekDouble eq = pow( 81.0 * nBasisFunc + 3.0 * sqrt(-3.0 + 729.0 * nBasisFunc * nBasisFunc), 1.0/3.0);
225 int degree = int(
MakeRound(eq/3.0 + 1.0/eq - 1.0)) - 1;
227 ASSERTL1(
GetTetNumPoints(degree) == nBasisFunc,
"The number of points defines an expansion of fractional degree, which is not supported." );
233 return floor(x + 0.5);
239 int cols = (degree + 1)*(degree + 2)/2;
240 NekMatrix<NekDouble>matV(rows,cols, 0.0);
242 for(
int d=0, n=0; d <= degree; ++d)
244 for(
int p=0; p <= d; ++p, ++n)
248 for(
int i=0; i<rows; ++i)
250 matV(i, n) = pow(x[i], p) * pow(y[i], q);
261 int cols = (degree + 1) * (degree + 2) * (degree + 3)/6;
263 NekMatrix<NekDouble> matV(rows, cols, 0.0);
265 for(
int d=0, n=0; d<=degree; ++d)
267 for(
int p=0; p <= d; ++p)
269 for(
int q=0; q <= d - p; ++q, ++n)
274 for(
int i=0; i<rows; ++i)
276 matV(i,n) = pow(x[i],p) * pow(y[i],q) * pow(z[i],r);
301 int cols = (degree + 1) * (degree + 2) / 2;
302 NekMatrix<NekDouble> matVx(rows, cols, 0.0);
304 for(
int d=0, n=0; d <= degree; ++d)
306 for(
int p=0; p <= d; ++p, ++n)
312 for(
int i=0; i<rows; ++i)
314 matVx(i, n) = p * pow(x[i], p-1.0) * pow(y[i],q);
319 for(
int j=0; j<rows; ++j)
340 int cols = (degree + 1) * (degree + 2) * (degree + 3) / 6;
341 NekMatrix<NekDouble> matVx(rows, cols, 0.0);
342 for(
int d=0, n=0; d<=degree; ++d)
344 for(
int p=0; p <= d; ++p)
346 for(
int q=0; q <= d - p; ++q, ++n)
352 for(
int i=0; i<rows; ++i)
354 matVx(i,n) = p * pow(x[i],p-1.0) * pow(y[i],q) * pow(z[i],r);
358 for(
int j=0; j<rows; ++j)
381 int cols = (degree + 1) * (degree + 2) * (degree + 3) / 6;
382 NekMatrix<NekDouble> matVy(rows, cols, 0.0);
383 for(
int d=0, n=0; d<=degree; ++d)
385 for(
int p=0; p <= d; ++p)
387 for(
int q=0; q <= d - p; ++q, ++n)
393 for(
int i=0; i<rows; ++i)
395 matVy(i,n) = q * pow(x[i],p) * pow(y[i],q-1.0) * pow(z[i],r);
400 for(
int j=0; j<rows; ++j)
423 int cols = (degree + 1) * (degree + 2) * (degree + 3) / 6;
424 NekMatrix<NekDouble> matVz(rows, cols, 0.0);
425 for(
int d=0, n=0; d<=degree; ++d)
427 for(
int p=0; p <= d; ++p)
429 for(
int q=0; q <= d - p; ++q, ++n)
435 for(
int i=0; i<rows; ++i)
437 matVz(i,n) = r * pow(x[i],p) * pow(y[i],q) * pow(z[i],r-1.0);
441 for(
int j=0; j<rows; ++j)
463 int cols = (degree + 1) * (degree + 2) / 2;
464 NekMatrix<NekDouble> matVy(rows, cols, 0.0);
466 for(
int d=0, n=0; d <= degree; ++d)
468 for(
int p=0; p <= d; ++p, ++n)
473 for(
int i=0; i<rows; ++i)
475 matVy(i, n) = q * pow(x[i], p) * pow(y[i], q-1.0);
480 for(
int j=0; j<rows; ++j)
499 int cols = (degree + 1) * (degree + 2) / 2;
502 for(
int d=0, n=0; d <= degree; ++d)
504 for(
int p=0; p <= d; ++p, ++n)
507 int sp = 1 - 2 * (p % 2);
508 int sq = 1 - 2 * (q % 2);
510 integralMVandermonde(n) =
NekDouble(sp * (p+1) + sq * (q+1) + sp * sq * (p+q+2)) / ((p+1) * (q+1) * (p+q+2));
513 return integralMVandermonde;