diff --git a/p3/lrls/helper.go b/p3/lrls/helper.go index 3b67025..2620e6f 100644 --- a/p3/lrls/helper.go +++ b/p3/lrls/helper.go @@ -56,3 +56,50 @@ func covMatrices(size, params int) ([]*mat.Dense, error) { return cms, nil } + +// nolint: unused +func newTheta(size, params int) ([][]float64, error) { + switch { + case size < 1: + return nil, errors.New("ErrThetaSize") + + case params < 4 || params > 5: + log.Printf("error: params needs to be from the set {4 ,5}, got: %d", params) + return nil, errors.New("ErrBadParams") + } + + th := make([][]float64, size) + + // initialise. + for i := range th { + th[i] = make([]float64, params) + } + + // specifically set the second vector to all 0.1s. + for i := range th[1] { + th[1][i] = 0.1 + } + + return th, nil +} + +// nolint: unused +func newFi(size, params int) ([][]float64, error) { + switch { + case size < 1: + return nil, errors.New("ErrFiSize") + + case params < 4 || params > 5: + log.Printf("error: params needs to be from the set {4 ,5}, got: %d", params) + return nil, errors.New("ErrBadParams") + } + + fi := make([][]float64, size) + + // prealloc. + for i := range fi { + fi[i] = make([]float64, params) + } + + return fi, nil +}