|
4 | 4 |
|
5 | 5 | using System;
|
6 | 6 | using System.Collections.Generic;
|
7 |
| -using System.Globalization; |
8 |
| -using System.Linq; |
9 | 7 | using System.Numerics;
|
10 | 8 | using Microsoft.ML.Runtime;
|
11 | 9 | using Microsoft.ML.Runtime.Data;
|
@@ -290,8 +288,8 @@ public AdaptiveSingularSpectrumSequenceModeler(IHostEnvironment env, int trainSi
|
290 | 288 |
|
291 | 289 | _alpha = new Single[windowSize - 1];
|
292 | 290 | _state = new Single[windowSize - 1];
|
293 |
| - _x = new CpuAlignedVector(windowSize, SseUtils.CbAlign); |
294 |
| - _xSmooth = new CpuAlignedVector(windowSize, SseUtils.CbAlign); |
| 291 | + _x = new CpuAlignedVector(windowSize, CpuMathUtils.GetVectorAlignment()); |
| 292 | + _xSmooth = new CpuAlignedVector(windowSize, CpuMathUtils.GetVectorAlignment()); |
295 | 293 | ShouldComputeForecastIntervals = shouldComputeForecastIntervals;
|
296 | 294 |
|
297 | 295 | _observationNoiseVariance = 0;
|
@@ -345,13 +343,13 @@ private AdaptiveSingularSpectrumSequenceModeler(AdaptiveSingularSpectrumSequence
|
345 | 343 | _state = new Single[_windowSize - 1];
|
346 | 344 | Array.Copy(model._state, _state, _windowSize - 1);
|
347 | 345 |
|
348 |
| - _x = new CpuAlignedVector(_windowSize, SseUtils.CbAlign); |
349 |
| - _xSmooth = new CpuAlignedVector(_windowSize, SseUtils.CbAlign); |
| 346 | + _x = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment()); |
| 347 | + _xSmooth = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment()); |
350 | 348 |
|
351 | 349 | if (model._wTrans != null)
|
352 | 350 | {
|
353 |
| - _y = new CpuAlignedVector(_rank, SseUtils.CbAlign); |
354 |
| - _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign); |
| 351 | + _y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment()); |
| 352 | + _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment()); |
355 | 353 | _wTrans.CopyFrom(model._wTrans);
|
356 | 354 | }
|
357 | 355 | }
|
@@ -452,18 +450,18 @@ public AdaptiveSingularSpectrumSequenceModeler(IHostEnvironment env, ModelLoadCo
|
452 | 450 | {
|
453 | 451 | var tempArray = ctx.Reader.ReadFloatArray();
|
454 | 452 | _host.CheckDecode(Utils.Size(tempArray) == _rank * _windowSize);
|
455 |
| - _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign); |
| 453 | + _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment()); |
456 | 454 | int i = 0;
|
457 | 455 | _wTrans.CopyFrom(tempArray, ref i);
|
458 | 456 | tempArray = ctx.Reader.ReadFloatArray();
|
459 | 457 | i = 0;
|
460 |
| - _y = new CpuAlignedVector(_rank, SseUtils.CbAlign); |
| 458 | + _y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment()); |
461 | 459 | _y.CopyFrom(tempArray, ref i);
|
462 | 460 | }
|
463 | 461 |
|
464 | 462 | _buffer = TimeSeriesUtils.DeserializeFixedSizeQueueSingle(ctx.Reader, _host);
|
465 |
| - _x = new CpuAlignedVector(_windowSize, SseUtils.CbAlign); |
466 |
| - _xSmooth = new CpuAlignedVector(_windowSize, SseUtils.CbAlign); |
| 463 | + _x = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment()); |
| 464 | + _xSmooth = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment()); |
467 | 465 | }
|
468 | 466 |
|
469 | 467 | public override void Save(ModelSaveContext ctx)
|
@@ -1130,8 +1128,8 @@ internal override void Consume(ref Single input, bool updateModel = false)
|
1130 | 1128 |
|
1131 | 1129 | if (_wTrans == null)
|
1132 | 1130 | {
|
1133 |
| - _y = new CpuAlignedVector(_rank, SseUtils.CbAlign); |
1134 |
| - _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign); |
| 1131 | + _y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment()); |
| 1132 | + _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment()); |
1135 | 1133 | Single[] vecs = new Single[_rank * _windowSize];
|
1136 | 1134 |
|
1137 | 1135 | for (i = 0; i < _rank; ++i)
|
@@ -1311,8 +1309,8 @@ private void TrainCore(Single[] dataArray, int originalSeriesLength)
|
1311 | 1309 | _maxRank = _windowSize / 2;
|
1312 | 1310 | _alpha = new Single[_windowSize - 1];
|
1313 | 1311 | _state = new Single[_windowSize - 1];
|
1314 |
| - _x = new CpuAlignedVector(_windowSize, SseUtils.CbAlign); |
1315 |
| - _xSmooth = new CpuAlignedVector(_windowSize, SseUtils.CbAlign); |
| 1312 | + _x = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment()); |
| 1313 | + _xSmooth = new CpuAlignedVector(_windowSize, CpuMathUtils.GetVectorAlignment()); |
1316 | 1314 |
|
1317 | 1315 | TrainCore(dataArray, originalSeriesLength);
|
1318 | 1316 | return;
|
@@ -1349,10 +1347,10 @@ private void TrainCore(Single[] dataArray, int originalSeriesLength)
|
1349 | 1347 | }
|
1350 | 1348 |
|
1351 | 1349 | // Setting the the y vector
|
1352 |
| - _y = new CpuAlignedVector(_rank, SseUtils.CbAlign); |
| 1350 | + _y = new CpuAlignedVector(_rank, CpuMathUtils.GetVectorAlignment()); |
1353 | 1351 |
|
1354 | 1352 | // Setting the weight matrix
|
1355 |
| - _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, SseUtils.CbAlign); |
| 1353 | + _wTrans = new CpuAlignedMatrixRow(_rank, _windowSize, CpuMathUtils.GetVectorAlignment()); |
1356 | 1354 | i = 0;
|
1357 | 1355 | _wTrans.CopyFrom(leftSingularVecs, ref i);
|
1358 | 1356 |
|
|
0 commit comments