mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
Refactor code formatting and improve consistency across various test files
- Removed unnecessary blank lines in multiple test files to enhance readability. - Ensured consistent spacing and formatting in the `Trima`, `Usf`, `Vidya`, `Wma`, and `Atr` test classes. - Updated comments for clarity and consistency in the `Atr` and `Adl` classes. - Adjusted project files for better structure and maintainability.
This commit is contained in:
@@ -29,7 +29,7 @@ public sealed class LinRegValidationTests : IDisposable
|
||||
{
|
||||
var period = 14;
|
||||
var skender = _data.SkenderQuotes.GetSlope(period).ToList();
|
||||
|
||||
|
||||
var linreg = new LinReg(period);
|
||||
var slopeSeries = new TSeries();
|
||||
foreach (var item in _data.Data)
|
||||
@@ -47,7 +47,7 @@ public sealed class LinRegValidationTests : IDisposable
|
||||
{
|
||||
var period = 14;
|
||||
var skender = _data.SkenderQuotes.GetSlope(period).ToList();
|
||||
|
||||
|
||||
var linreg = new LinReg(period);
|
||||
var r2Series = new TSeries();
|
||||
foreach (var item in _data.Data)
|
||||
|
||||
@@ -166,7 +166,7 @@ public sealed class LinReg : AbstractBase
|
||||
_state.SumY = _buffer.Sum;
|
||||
_state.SumXY = 0;
|
||||
var span = _buffer.GetSpan();
|
||||
|
||||
|
||||
// Vectorized SumY2
|
||||
_state.SumY2 = span.DotProduct(span);
|
||||
|
||||
@@ -248,7 +248,7 @@ public sealed class LinReg : AbstractBase
|
||||
// R2 = (n * sum_xy - sum_x * sum_y)^2 / ( (n * sum_x2 - sum_x^2) * (n * sum_y2 - sum_y^2) )
|
||||
double numerator = Math.FusedMultiplyAdd(n, _state.SumXY, -sx * _state.SumY);
|
||||
double term2 = Math.FusedMultiplyAdd(n, _state.SumY2, -_state.SumY * _state.SumY);
|
||||
|
||||
|
||||
RSquared = Math.Abs(term2) < MinDenominator
|
||||
? 1.0 // All y are same
|
||||
: numerator * numerator / (denom * term2);
|
||||
|
||||
Reference in New Issue
Block a user