QLNet.Matrix.outerProduct C# (CSharp) 메소드

outerProduct() 공개 정적인 메소드

public static outerProduct ( List v1begin, List v2begin ) : Matrix
v1begin List
v2begin List
리턴 Matrix
        public static Matrix outerProduct(List<double> v1begin, List<double> v2begin)
        {
            int size1 = v1begin.Count;
            if (!(size1>0)) throw new ApplicationException("null first vector");

            int size2 = v2begin.Count;
            if(!(size2>0)) throw new ApplicationException("null second vector");

            Matrix result = new Matrix(size1, size2);

            for (int i=0; i<v1begin.Count; i++)
                for(int j=0; j<v2begin.Count; j++)
                    result[i,j] = v1begin[i] * v2begin[j];
            return result;
        }

Usage Example

예제 #1
0
        //! returns the covariance Matrix
        public Matrix covariance()
        {
            double sampleWeight = weightSum();

            if (!(sampleWeight > 0.0))
            {
                throw new ApplicationException("sampleWeight=0, unsufficient");
            }

            double sampleNumber = samples();

            if (!(sampleNumber > 1.0))
            {
                throw new ApplicationException("sample number <=1, unsufficient");
            }

            List <double> m   = mean();
            double        inv = 1.0 / sampleWeight;

            Matrix result = inv * quadraticSum_;

            result -= Matrix.outerProduct(m, m);

            result *= (sampleNumber / (sampleNumber - 1.0));
            return(result);
        }
All Usage Examples Of QLNet.Matrix::outerProduct