public void Unit() { int rows = GetRows(); int cols = GetCols(); float magnitude = 0f; for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { float value = GetValue(i, j); magnitude += value * value; } } magnitude = Mathf.Sqrt(magnitude); if (magnitude != 0f) { Eigen.Scale(Ptr, 1f / magnitude, Ptr); } }
public static Tensor Scale(Tensor lhs, float value, Tensor OUT) { Eigen.Scale(lhs.Ptr, value, OUT.Ptr); return(OUT); }
public static Matrix Scale(Matrix lhs, float value, Matrix OUT) { Eigen.Scale(lhs.Ptr, value, OUT.Ptr); return(OUT); }
public Tensor Scale(Tensor LHS, float value, Tensor OUT) { Eigen.Scale(LHS.Ptr, value, OUT.Ptr); return(OUT); }