func New(a, b []float64, w int) (*MatrixProfile, error) {
	if a == nil || len(a) == 0 {
		return nil, fmt.Errorf("first slice is nil or has a length of 0")
	}
	if b != nil && len(b) == 0 {
		return nil, fmt.Errorf("second slice must be nil for self-join operation or have a length greater than 0")
	}
	mp := MatrixProfile{
		A: a,
		W: w,
		N: len(b),
	}
	if b == nil {
		mp.N = len(a)
		mp.B = a
		mp.SelfJoin = true
	} else {
		mp.B = b
	}
	if mp.W > len(mp.A) || mp.W > len(mp.B) {
		return nil, fmt.Errorf("subsequence length must be less than the timeseries")
	}
	if mp.W < 2 {
		return nil, fmt.Errorf("subsequence length must be at least 2")
	}
	mp.AV = av.Default
	return &mp, nil
}
New creates a matrix profile struct with a given timeseries length n and
subsequence length of m. The first slice, a, is used as the initial
timeseries to join with the second, b. If b is nil, then the matrix profile
assumes a self join on the first timeseries.
package matrixprofile
import (
	"container/heap"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"math"
	"math/rand"
	"os"
	"runtime"
	"sort"
	"strconv"
	"sync"
	"github.com/matrix-profile-foundation/go-matrixprofile/av"
	"github.com/matrix-profile-foundation/go-matrixprofile/util"
	"gonum.org/v1/gonum/dsp/fourier"
	"gonum.org/v1/gonum/floats"
	"gonum.org/v1/plot/plotter"
)
type MatrixProfile struct {
	A        []float64    `json:"a"`                  
	B        []float64    `json:"b"`                  
	AMean    []float64    `json:"a_mean"`             
	AStd     []float64    `json:"a_std"`              
	BMean    []float64    `json:"b_mean"`             
	BStd     []float64    `json:"b_std"`              
	BF       []complex128 `json:"b_fft"`              
	N        int          `json:"n"`                  
	W        int          `json:"w"`                  
	SelfJoin bool         `json:"self_join"`          
	MP       []float64    `json:"mp"`                 
	Idx      []int        `json:"pi"`                 
	MPB      []float64    `json:"mp_ba"`              
	IdxB     []int        `json:"pi_ba"`              
	AV       av.AV        `json:"annotation_vector"`  
	Opts     *MPOpts      `json:"options"`            
	Motifs   []MotifGroup
	Discords []int
}