/// <summary> /// Calculates the weighted sum on the columns of data. /// </summary> /// <param name="data">The data columns to calculate on.</param> /// <param name="weight">The weights to use on the data columns (must be length data.Rows).</param> /// <returns>The sum vectorT.</returns> public static vectorT Sum(matrix data, vector weight) { var r = new vectorT(data.Cols); ThrowHelper.Check(Vsl.SumWeighted(data.Rows, data.Cols, data.Array, weight.Array, r.Array)); return(r); }
/// <summary> /// Calculates the median on the columns of data. /// </summary> /// <param name="data">The data columns to calculate on.</param> /// <returns>The median vectorT.</returns> public static vectorT Median(matrix data) { var r = new vectorT(data.Cols); ThrowHelper.Check(Vsl.Median(data.Rows, data.Cols, data.Array, r.Array)); return(r); }
/// <summary> /// Calculates the weighted correlation on the columns of data. /// </summary> /// <param name="data">The data columns to calculate on.</param> /// <param name="weight">The weights to use on the data columns (must be length data.Rows).</param> /// <param name="mean">The calculated mean.</param> /// <returns>data.Cols x data.Cols matrix.</returns> public static matrix Correlation(matrix data, vector weight, out vectorT mean) { mean = new vectorT(data.Cols); var cor = new matrix(data.Cols, data.Cols); ThrowHelper.Check(Vsl.CorrelationWeighted(data.Rows, data.Cols, data.Array, weight.Array, mean.Array, cor.Array)); return(cor); }
/// <summary> /// Calculates the weighted covariance on the columns of data. /// </summary> /// <param name="data">The data columns to calculate on.</param> /// <param name="weight">The weights to use on the data columns (must be length data.Rows).</param> /// <param name="mean">The calculated mean.</param> /// <returns>data.Cols x data.Cols matrix.</returns> public static matrix Covariance(matrix data, vector weight, out vectorT mean) { mean = new vectorT(data.Cols); var cov = new matrix(data.Cols, data.Cols); ThrowHelper.Check(Vsl.CovarianceWeighted(data.Rows, data.Cols, data.Array, weight.Array, mean.Array, cov.Array)); return(cov); }
/// <summary> /// Calculates the weighted median and MAD on the columns of data. /// </summary> /// <param name="data">The data columns to calculate on.</param> /// <param name="weight">The weights to use on the data columns (must be length data.Rows).</param> /// <param name="mad">The calculated MAD.</param> /// <returns>The median vectorT.</returns> public static vectorT MedianMAD(matrix data, vector weight, out vectorT mad) { var median = new vectorT(data.Cols); mad = new vectorT(data.Cols); ThrowHelper.Check(Vsl.MedianMADWeighted(data.Rows, data.Cols, data.Array, weight.Array, median.Array, mad.Array)); return(median); }
public VectorTReuse(vectorT a) => V = a;
public VectorTInput(vectorT a) => V = a;