testChebTensorProduct.cpp 15.6 KB
Newer Older
1
// See LICENCE file at project root
2 3 4 5 6 7 8 9 10 11 12

// ==== CMAKE =====
// @FUSE_BLAS
// ================

#include <iostream>

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

13 14 15 16
#include "Utils/FTic.hpp"
#include "Utils/FMath.hpp"
#include "Utils/FBlas.hpp"
#include "Utils/FParameters.hpp"
17

18
#include "Containers/FVector.hpp"
19

20 21
#include "Utils/FAssert.hpp"
#include "Utils/FPoint.hpp"
22

23 24
#include "Kernels/Chebyshev/FChebTensor.hpp"
#include "Kernels/Chebyshev/FChebInterpolator.hpp"
25

26
#include "Utils/FParameterNames.hpp"
27

28
template <class FReal>
29 30 31
void applyM2M(FReal *const S,	FReal *const w, const unsigned int n,	FReal *const W, const unsigned int N)
{ FBlas::gemtva(n, N, FReal(1.), S,	w, W); }

32
template <class FReal>
33 34 35
void applym2m(FReal *const S,	FReal *const w, const unsigned int n,	FReal *const W, const unsigned int N)
{ FBlas::gemtm(n, n, n*n, FReal(1.), S, n, w, n, W, n); }

36
template <class FReal>
37
void applyL2L(FReal *const S,	FReal *const F, const unsigned int n,	FReal *const f, const unsigned int N)
38
{ FBlas::gemva(N, n, FReal(1.), S, F, f);	}
39

40
template <class FReal>
41 42 43 44 45
void applyl2l(FReal *const S,	FReal *const F, const unsigned int n,	FReal *const f, const unsigned int N)
{ FBlas::gemm(n, n, n*n, FReal(1.), S, n, F, n, f, n); }


/**
46 47
 * In this file we show how to use octree
 */
48 49 50

int main(int argc, char* argv[])
{
51 52
    FHelpDescribeAndExit(argc, argv, "Test Chebyshev tensor product.");

53
    typedef double FReal;
54
	const unsigned int ORDER = 10;
55
	const unsigned int nnodes = TensorTraits<ORDER>::nnodes;
56 57
    FPoint<FReal> X[nnodes];
	FChebInterpolator<FReal,ORDER> Interpolator;
58 59

	{
60 61
        FChebTensor<FReal,ORDER>::setRoots(FPoint<FReal>(0.,0.,0.), FReal(2.), X);
        FPoint<FReal> x[nnodes];
62
	
63 64 65 66 67 68 69 70
        //	const FPoint<FReal> cx(-.5, -.5, -.5);
        //	const FPoint<FReal> cx(-.5, -.5,  .5);
        //	const FPoint<FReal> cx(-.5,  .5, -.5);
        //	const FPoint<FReal> cx(-.5,  .5,  .5);
        //	const FPoint<FReal> cx( .5, -.5, -.5);
        //	const FPoint<FReal> cx( .5, -.5,  .5);
        //	const FPoint<FReal> cx( .5,  .5, -.5);
        const FPoint<FReal> cx( .5,  .5,  .5);
71
		const FReal  wx(1.);
72
		FChebTensor<FReal,ORDER>::setRoots(cx, wx, x);
73 74 75 76 77 78
	
		FReal w[nnodes], f[nnodes];
		for (unsigned int n=0; n<nnodes; ++n) {
			w[n] = f[n] = FReal(n);
			//		std::cout << w[n] << "\t" << X[n] << "\t" << x[n] << std::endl;
		}
79 80 81



82
		FReal coords[3][ORDER];
83
		FChebTensor<FReal,ORDER>::setPolynomialsRoots(cx, wx, coords);
84
	
85 86 87 88 89
		//	for (unsigned int n=0; n<ORDER; ++n) {
		//		std::cout << coords[0][n] << "\t"
		//							<< coords[1][n] << "\t"
		//							<< coords[2][n] << std::endl;
		//	}
90

91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
		FReal S[3][ORDER*ORDER];
		Interpolator.assembleInterpolator(ORDER, coords[0], S[0]);
		Interpolator.assembleInterpolator(ORDER, coords[1], S[1]);
		Interpolator.assembleInterpolator(ORDER, coords[2], S[2]);

		FReal Skron[nnodes * nnodes];
		Interpolator.assembleInterpolator(nnodes, x, Skron);



		FReal W0[nnodes];
		for (unsigned int i=0; i<nnodes; ++i) W0[i] = FReal(0.);
		applyM2M(Skron, w, nnodes, W0, nnodes);


		FReal F0[nnodes];
		for (unsigned int i=0; i<nnodes; ++i) F0[i] = FReal(0.);
		applyL2L(Skron, f, nnodes, F0, nnodes);




		unsigned int perm[3][nnodes];
		for (unsigned int i=0; i<ORDER; ++i) {
			for (unsigned int j=0; j<ORDER; ++j) {
				for (unsigned int k=0; k<ORDER; ++k) {
					const unsigned int index = k*ORDER*ORDER + j*ORDER + i;
					perm[0][index] = k*ORDER*ORDER + j*ORDER + i;
					perm[1][index] = i*ORDER*ORDER + k*ORDER + j;
					perm[2][index] = j*ORDER*ORDER + i*ORDER + k;
				}
122 123 124
			}
		}

125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
		//	for (unsigned int n=0; n<nnodes; ++n)
		//		std::cout << perm[0][n] << "\t" << perm[1][n] << "\t" << perm[2][n] << std::endl;


		FReal W[nnodes];
		for (unsigned int i=0; i<nnodes; ++i) W[i] = FReal(0.);
		applym2m(S[0], w, ORDER, W, ORDER);
		for (unsigned int n=0; n<nnodes; ++n)	w[n] = W[perm[1][n]];
		applym2m(S[2], w, ORDER, W, ORDER);
		for (unsigned int n=0; n<nnodes; ++n)	w[perm[1][n]] = W[perm[2][n]];
		applym2m(S[1], w, ORDER, W, ORDER);
		for (unsigned int n=0; n<nnodes; ++n)	w[perm[2][n]] = W[n];
		FReal m2m_error(0.);
		for (unsigned int n=0; n<nnodes; ++n) {
			//std::cout << n << "\t" << w[n] << " - " << W0[n] << " = " << w[n]-W0[n] << std::endl;
			m2m_error += w[n] - W0[n];
		}
142

143 144
		std::cout << "------------------------------------------"
							<< "\n - M2M: ERROR = " << m2m_error << std::endl;
145 146 147



148 149 150 151 152 153 154 155
		FReal F[nnodes];
		for (unsigned int i=0; i<nnodes; ++i) F[i] = FReal(0.);
		applyl2l(S[0], f, ORDER, F, ORDER);
		for (unsigned int n=0; n<nnodes; ++n)	f[n] = F[perm[1][n]];
		applyl2l(S[2], f, ORDER, F, ORDER);
		for (unsigned int n=0; n<nnodes; ++n)	f[perm[1][n]] = F[perm[2][n]];
		applyl2l(S[1], f, ORDER, F, ORDER);
		for (unsigned int n=0; n<nnodes; ++n)	f[perm[2][n]] = F[n];
156

157 158 159 160 161
		FReal l2l_error(0.);
		for (unsigned int n=0; n<nnodes; ++n) {
			//std::cout << n << "\t" << f[n] << " - " << F0[n] << " = " << f[n]-F0[n] << std::endl;
			l2l_error += f[n] - F0[n];
		}
162 163 164
		
		std::cout << "------------------------------------------"
							<< "\n - L2L: ERROR = " << l2l_error << std::endl;
165 166 167 168 169 170 171 172 173 174 175 176 177
		
	}

	////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
	// P2M /////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
		

	const unsigned int M = 10;
	FReal points[3][M];
	FReal weights[M];
178
    FPoint<FReal> lp[M];
179 180
	FReal equivW[nnodes];

BRAMAS Berenger's avatar
BRAMAS Berenger committed
181
    { ////////////////////////////////////////////////////////
182
		for(unsigned int p=0; p<M; ++p){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
183 184 185 186
            points[0][p] = (FReal(drand48()) - FReal(.5)) * FReal(2.);
            points[1][p] = (FReal(drand48()) - FReal(.5)) * FReal(2.);
            points[2][p] = (FReal(drand48()) - FReal(.5)) * FReal(2.);
            weights[p] = FReal(drand48());
187 188 189 190 191
			lp[p].setX(points[0][p]);
			lp[p].setY(points[1][p]);
			lp[p].setZ(points[2][p]);
		}
	} ////////////////////////////////////////////////////////
192

193
	
194
	{ // compute exact equivalent source values
195 196 197 198 199
		for(unsigned int i=0; i<nnodes; ++i) equivW[i] = FReal(0.);
		FReal Snorm[M * nnodes];
		Interpolator.assembleInterpolator(M, lp, Snorm);
		applyM2M(Snorm, weights, M, equivW, nnodes);
	}
200

201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
	FReal W1;
	FReal W2[3][ ORDER-1];
	FReal W4[3][(ORDER-1)*(ORDER-1)];
	FReal W8[   (ORDER-1)*(ORDER-1)*(ORDER-1)];
	
	{ ////////////////////////////////////////////////////////
		W1 = FReal(0.);
		for(unsigned int i=0; i<ORDER-1; ++i)
			W2[0][i] = W2[1][i] = W2[2][i] = FReal(0.);
		for(unsigned int i=0; i<(ORDER-1)*(ORDER-1); ++i)
			W4[0][i] = W4[1][i] = W4[2][i] = FReal(0.);
		for(unsigned int i=0; i<(ORDER-1)*(ORDER-1)*(ORDER-1); ++i)
			W8[i] = FReal(0.);
		
		// loop over source particles
		for (unsigned int p=0; p<M; ++p) {
			FReal T_of_x[3][ORDER];
			T_of_x[0][0] = FReal(1.); T_of_x[0][1] = points[0][p];
			T_of_x[1][0] = FReal(1.); T_of_x[1][1] = points[1][p];
			T_of_x[2][0] = FReal(1.); T_of_x[2][1] = points[2][p];
			const FReal x2 = FReal(2.) * T_of_x[0][1]; // 1 flop
			const FReal y2 = FReal(2.) * T_of_x[1][1]; // 1 flop
			const FReal z2 = FReal(2.) * T_of_x[2][1]; // 1 flop
			for (unsigned int j=2; j<ORDER; ++j) {
				T_of_x[0][j] = x2 * T_of_x[0][j-1] - T_of_x[0][j-2]; // 2 flops
				T_of_x[1][j] = y2 * T_of_x[1][j-1] - T_of_x[1][j-2]; // 2 flops
				T_of_x[2][j] = z2 * T_of_x[2][j-1] - T_of_x[2][j-2]; // 2 flops
			}
			
			W1 += weights[p]; // 1 flop
			for (unsigned int i=1; i<ORDER; ++i) {
				const FReal wx = weights[p] * T_of_x[0][i]; // 1 flop
				const FReal wy = weights[p] * T_of_x[1][i]; // 1 flop
				const FReal wz = weights[p] * T_of_x[2][i]; // 1 flop
				W2[0][i-1] += wx; // 1 flop
				W2[1][i-1] += wy; // 1 flop
				W2[2][i-1] += wz; // 1 flop
				for (unsigned int j=1; j<ORDER; ++j) {
					const FReal wxy = wx * T_of_x[1][j]; // 1 flop
					const FReal wxz = wx * T_of_x[2][j]; // 1 flop
					const FReal wyz = wy * T_of_x[2][j]; // 1 flop
					W4[0][(j-1)*(ORDER-1) + (i-1)] += wxy; // 1 flop
					W4[1][(j-1)*(ORDER-1) + (i-1)] += wxz; // 1 flop
					W4[2][(j-1)*(ORDER-1) + (i-1)] += wyz; // 1 flop
					for (unsigned int k=1; k<ORDER; ++k) {
						const FReal wxyz = wxy * T_of_x[2][k]; // 1 flop
						W8[(k-1)*(ORDER-1)*(ORDER-1) + (j-1)*(ORDER-1) + (i-1)] += wxyz; // 1 flop
					} // flops: (ORDER-1) * 2
				} // flops: (ORDER-1) * (6 + (ORDER-1) * 2) 
			} // flops: (ORDER-1) * (6 + (ORDER-1) * (6 + (ORDER-1) * 2))
			
		} // flops: M * (3 + (ORDER-2) * 6 + (ORDER-1) * (6 + (ORDER-1) * (6 + (ORDER-1) * 2)))

	} ////////////////////////////////////////////////////////


	FReal F2[3][ORDER];
	FReal F4[3][ORDER*ORDER];
	FReal F8[   ORDER*ORDER*ORDER];

	{ ////////////////////////////////////////////////////////
262 263
		for(unsigned int i=0; i<ORDER; ++i)
			F2[0][i] = F2[1][i] = F2[2][i] = FReal(0.);
264 265 266 267 268 269 270 271
		for(unsigned int i=0; i<ORDER*ORDER; ++i)
			F4[0][i] = F4[1][i] = F4[2][i] = FReal(0.);
		for(unsigned int i=0; i<ORDER*ORDER*ORDER; ++i)
			F8[i] = FReal(0.);

		FReal T_of_y[ORDER * (ORDER-1)];
    for (unsigned int o=1; o<ORDER; ++o)
      for (unsigned int j=0; j<ORDER; ++j)
272
        T_of_y[(o-1)*ORDER + j] = FReal(FChebRoots<FReal,ORDER>::T(o, FReal(FChebRoots<FReal,ORDER>::roots[j])));
273

274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
		for (unsigned int l=0; l<ORDER-1; ++l)
			for (unsigned int i=0; i<ORDER; ++i) {
				F2[0][i] += T_of_y[l*ORDER + i] * W2[0][l];
				F2[1][i] += T_of_y[l*ORDER + i] * W2[1][l];
				F2[2][i] += T_of_y[l*ORDER + i] * W2[2][l];
				
				for (unsigned int m=0; m<ORDER-1; ++m)
					for (unsigned int j=0; j<ORDER; ++j) {
						F4[0][j*ORDER + i] += T_of_y[l*ORDER + i] * T_of_y[m*ORDER + j] * W4[0][m*(ORDER-1) + l];
						F4[1][j*ORDER + i] += T_of_y[l*ORDER + i] * T_of_y[m*ORDER + j] * W4[1][m*(ORDER-1) + l];
						F4[2][j*ORDER + i] += T_of_y[l*ORDER + i] * T_of_y[m*ORDER + j] * W4[2][m*(ORDER-1) + l];
							
						for (unsigned int n=0; n<ORDER-1; ++n)
							for (unsigned int k=0; k<ORDER; ++k)
								F8[k*ORDER*ORDER + j*ORDER + i] +=
									T_of_y[l*ORDER + i] * T_of_y[m*ORDER + j] * T_of_y[n*ORDER + k]	*
									W8[n*(ORDER-1)*(ORDER-1) + m*(ORDER-1) + l];
								}
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
			}

	} ////////////////////////////////////////////////////////


	FReal W[nnodes];
	{
		//for (unsigned int i=0; i<nnodes; ++i) W[i] = FReal(0.);
		for (unsigned int i=0; i<ORDER; ++i) {
			for (unsigned int j=0; j<ORDER; ++j) {
				for (unsigned int k=0; k<ORDER; ++k) {
					const unsigned int idx = k*ORDER*ORDER + j*ORDER + i;
					W[idx] = (W1 +
										FReal(2.) * (F2[0][i] + F2[1][j] + F2[2][k]) +
										FReal(4.) * (F4[0][j*ORDER+i] + F4[1][k*ORDER+i] + F4[2][k*ORDER+j]) +
										FReal(8.) *  F8[idx]) / (ORDER*ORDER*ORDER);
				}
			}
		}
	}
312

313 314 315 316
	FReal p2m_error(0.);
	for (unsigned int i=0; i<nnodes; ++i) {
		p2m_error += W[i] - equivW[i];
		//std::cout << W[i] - equivW[i] << std::endl;
317
	}
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348

	std::cout << "------------------------------------------"
						<< "\n - P2M: ERROR = " << p2m_error << std::endl;



	////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
	// L2P /////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////


	FReal exactf[M];
	FReal f[M];
	for(unsigned int i=0; i<M; ++i) exactf[i] = f[i] = FReal(0.);


	{ // compute exact target values
		FReal Snorm[M * nnodes];
		Interpolator.assembleInterpolator(M, lp, Snorm);
		applyL2L(Snorm, W, nnodes, exactf, M);
		//for (unsigned int i=0; i<M; ++i)
		//	std::cout << exactf[i] << std::endl;
	}

	FReal f1;
	{ // sum over interpolation points
		FReal T_of_y[ORDER * (ORDER-1)];
    for (unsigned int o=1; o<ORDER; ++o)
      for (unsigned int j=0; j<ORDER; ++j)
349
        T_of_y[(o-1)*ORDER + j] = FReal(FChebRoots<FReal,ORDER>::T(o, FReal(FChebRoots<FReal,ORDER>::roots[j])));
350 351 352 353 354 355 356 357 358 359 360 361
		
		// set everything to zero
		f1 = FReal(0.);
		for(unsigned int i=0; i<ORDER-1; ++i)
			W2[0][i] = W2[1][i] = W2[2][i] = FReal(0.);
		for(unsigned int i=0; i<(ORDER-1)*(ORDER-1); ++i)
			W4[0][i] = W4[1][i] = W4[2][i] = FReal(0.);
		for(unsigned int i=0; i<(ORDER-1)*(ORDER-1)*(ORDER-1); ++i)
			W8[i] = FReal(0.);

		{
			unsigned int nids[nnodes][3];
362
			FChebTensor<FReal,ORDER>::setNodeIds(nids);
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444

			for (unsigned int idx=0; idx<nnodes; ++idx) {
				f1 += W[idx];
				const unsigned int i = nids[idx][0];
				const unsigned int j = nids[idx][1];
				const unsigned int k = nids[idx][2];
				
				//std::cout << i << "\t" << j << "\t" << k << std::endl;

				for (unsigned int l=0; l<ORDER-1; ++l) {
					W2[0][l] += T_of_y[l*ORDER+i] * W[idx];
					W2[1][l] += T_of_y[l*ORDER+j] * W[idx];
					W2[2][l] += T_of_y[l*ORDER+k] * W[idx];
					for (unsigned int m=0; m<ORDER-1; ++m) {
						W4[0][m*(ORDER-1)+l] += T_of_y[l*ORDER+i] * T_of_y[m*ORDER+j] * W[idx];
						W4[1][m*(ORDER-1)+l] += T_of_y[l*ORDER+i] * T_of_y[m*ORDER+k] * W[idx];
						W4[2][m*(ORDER-1)+l] += T_of_y[l*ORDER+j] * T_of_y[m*ORDER+k] * W[idx];
						for (unsigned int n=0; n<ORDER-1; ++n)
							W8[n*(ORDER-1)*(ORDER-1) + m*(ORDER-1) + l]
								+= T_of_y[l*ORDER+i]*T_of_y[m*ORDER+j]*T_of_y[n*ORDER+k] * W[idx];
					}
				}
			}

		}

	}

	{ // sum over targets
		for (unsigned int p=0; p<M; ++p) {

			FReal T_of_x[3][ORDER];
			{
				T_of_x[0][0] = FReal(1.); T_of_x[0][1] = points[0][p];
				T_of_x[1][0] = FReal(1.); T_of_x[1][1] = points[1][p];
				T_of_x[2][0] = FReal(1.); T_of_x[2][1] = points[2][p];
				const FReal x2 = FReal(2.) * T_of_x[0][1]; // 1 flop
				const FReal y2 = FReal(2.) * T_of_x[1][1]; // 1 flop
				const FReal z2 = FReal(2.) * T_of_x[2][1]; // 1 flop
				for (unsigned int j=2; j<ORDER; ++j) {
					T_of_x[0][j] = x2 * T_of_x[0][j-1] - T_of_x[0][j-2]; // 2 flops
					T_of_x[1][j] = y2 * T_of_x[1][j-1] - T_of_x[1][j-2]; // 2 flops
					T_of_x[2][j] = z2 * T_of_x[2][j-1] - T_of_x[2][j-2]; // 2 flops
				}
			}
			
			FReal f2, f4, f8;
			{
				f2 = f4 = f8 = FReal(0.);
				for (unsigned int l=1; l<ORDER; ++l) {
					f2 +=
						T_of_x[0][l] * W2[0][l-1] +
						T_of_x[1][l] * W2[1][l-1] +
						T_of_x[2][l] * W2[2][l-1];
					for (unsigned int m=1; m<ORDER; ++m) {
						f4 +=
							T_of_x[0][l] * T_of_x[1][m] * W4[0][(m-1)*(ORDER-1)+(l-1)] +
							T_of_x[0][l] * T_of_x[2][m] * W4[1][(m-1)*(ORDER-1)+(l-1)] +
							T_of_x[1][l] * T_of_x[2][m] * W4[2][(m-1)*(ORDER-1)+(l-1)];
						for (unsigned int n=1; n<ORDER; ++n)
							f8 +=
								T_of_x[0][l]*T_of_x[1][m]*T_of_x[2][n] *
								W8[(n-1)*(ORDER-1)*(ORDER-1) + (m-1)*(ORDER-1) + (l-1)];
					}
				}
			}
			f[p] = (f1 + FReal(2.)*f2 + FReal(4.)*f4 + FReal(8.)*f8) / (ORDER*ORDER*ORDER);
			
		}
	}


	FReal l2p_error(0.);
	for (unsigned int i=0; i<M; ++i) {
		l2p_error += f[i] - exactf[i];
		//std::cout << exactf[i] << "\t" << f[i] << std::endl;
	}

	std::cout << "------------------------------------------"
						<< "\n - L2P: ERROR = " << l2p_error << std::endl;


445 446 447 448 449 450 451


	return 0;
}


// [--END--]
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473

		//for (unsigned int l=0; l<ORDER-1; ++l)
		//	for (unsigned int m=0; m<ORDER-1; ++m)
		//		for (unsigned int n=0; n<ORDER-1; ++n)
		//			
		//			for (unsigned int i=0; i<ORDER; ++i)
		//				for (unsigned int j=0; j<ORDER; ++j)
		//					for (unsigned int k=0; k<ORDER; ++k) {
		//
		//						const unsigned int idx = k*ORDER*ORDER + j*ORDER + i;
		//
		//						W2[0][l] += T_of_y[l*ORDER+i] * W[idx];
		//						W2[1][m] += T_of_y[m*ORDER+j] * W[idx];
		//						W2[2][n] += T_of_y[n*ORDER+k] * W[idx];
		//
		//						W4[0][m*(ORDER-1) + l] += T_of_y[l*ORDER+i] * T_of_y[m*ORDER+j] * W[idx];
		//						W4[1][n*(ORDER-1) + l] += T_of_y[l*ORDER+i] * T_of_y[n*ORDER+k] * W[idx];
		//						W4[2][n*(ORDER-1) + m] += T_of_y[m*ORDER+j] * T_of_y[n*ORDER+k] * W[idx];
		//
		//						W8[n*(ORDER-1)*(ORDER-1) + m*(ORDER-1) + l]
		//							+= T_of_y[l*ORDER+i]*T_of_y[m*ORDER+j]*T_of_y[n*ORDER+k] * W[idx];
		//					}