/// <summary>Recreates an in-memory concat vector object from a Proto serialization.</summary> /// <param name="m">the concat vector proto</param> /// <returns>an in-memory concat vector object</returns> public static Edu.Stanford.Nlp.Loglinear.Model.ConcatVector ReadFromProto(ConcatVectorProto.ConcatVector m) { int components = m.GetComponentCount(); Edu.Stanford.Nlp.Loglinear.Model.ConcatVector vec = new Edu.Stanford.Nlp.Loglinear.Model.ConcatVector(); vec.pointers = new double[components][]; vec.sparse = new bool[components]; for (int i = 0; i < components; i++) { ConcatVectorProto.ConcatVector.Component c = m.GetComponent(i); vec.sparse[i] = c.GetSparse(); int dataSize = c.GetDataCount(); vec.pointers[i] = new double[dataSize]; for (int j = 0; j < dataSize; j++) { vec.pointers[i][j] = c.GetData(j); } } return(vec); }
/// <summary><code>repeated .edu.stanford.nlp.loglinear.model.proto.ConcatVector factorTable = 2;</code></summary> public ConcatVectorTableProto.ConcatVectorTable.Builder AddFactorTable(int index, ConcatVectorProto.ConcatVector value) { if (factorTableBuilder_ == null) { if (value == null) { throw new ArgumentNullException(); } EnsureFactorTableIsMutable(); factorTable_.Add(index, value); OnChanged(); } else { factorTableBuilder_.AddMessage(index, value); } return(this); }