mirror of
				https://github.com/gonum/gonum.git
				synced 2025-10-31 18:42:45 +08:00 
			
		
		
		
	use var in place of new
This commit is contained in:
		| @@ -33,15 +33,15 @@ func CovarianceMatrix(x mat64.Matrix) *mat64.Dense { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// todo: avoid matrix copy? | 	// todo: avoid matrix copy? | ||||||
| 	xt := new(mat64.Dense) | 	var xt mat64.Dense | ||||||
| 	xt.TCopy(xc) | 	xt.TCopy(xc) | ||||||
|  |  | ||||||
| 	// It would be nice if we could indicate that this was a symmetric | 	// It would be nice if we could indicate that this was a symmetric | ||||||
| 	// matrix. | 	// matrix. | ||||||
| 	ss := new(mat64.Dense) | 	var ss mat64.Dense | ||||||
| 	ss.Mul(xt, xc) | 	ss.Mul(&xt, xc) | ||||||
| 	ss.Scale(1/float64(r-1), ss) | 	ss.Scale(1/float64(r-1), &ss) | ||||||
| 	return ss | 	return &ss | ||||||
| } | } | ||||||
|  |  | ||||||
| // ones is a matrix of all ones. | // ones is a matrix of all ones. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jonathan J Lawlor
					Jonathan J Lawlor