Help language development. Donate to The Perl Foundation

Algorithm::HierarchicalPAM cpan:TITSUKI last updated on 2019-12-29

src/document.c
#include <stdlib.h>
#include <string.h>
#include "document.h"

struct document_model* hpam_create_document(int length, int* words) {
  struct document_model* model = (struct document_model*)malloc(sizeof(struct document_model));

  model->length = length;
  model->words = (int*)malloc(sizeof(int) * length);
  memcpy(model->words, words, sizeof(int) * length);
  return model;
}