<commit_before>/* Copyright 2016-present The KotlinNLP Authors. All Rights Reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, you can obtain one at http://mozilla.org/MPL/2.0/.
 * ------------------------------------------------------------------*/

package com.kotlinnlp.simplednn.core.arrays

import com.kotlinnlp.simplednn.simplemath.ndarray.dense.DenseNDArray
import com.kotlinnlp.simplednn.simplemath.ndarray.dense.DenseNDArrayFactory
import com.kotlinnlp.simplednn.simplemath.ndarray.Shape

/**
 * The [UpdatableDenseArray] is a wrapper of a [DenseNDArray]
 */
class UpdatableDenseArray(override val values: DenseNDArray) : UpdatableArray<DenseNDArray>(values = values) {

  /**
   * Build an [UpdatableDenseArray] with values initialized to zeros.
   *
   * @param shape the shape of the [values] array
   *
   * @return a new array with values initialized to zeros
   */
  constructor(shape: Shape) : this(DenseNDArrayFactory.zeros(shape))

  /**
   * Build an [UpdatableDenseArray] with values initialized to zeros.
   *
   * @param dim1 the first dimension of the array
   * @param dim2 the second dimension of the array (default = 1)
   *
   * @return a new dense array with values initialized to zeros
   */
  constructor(dim1: Int, dim2: Int = 1) : this(Shape(dim1, dim2))

  companion object {
<commit_msg>Set class as open<commit_after>/* Copyright 2016-present The KotlinNLP Authors. All Rights Reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, you can obtain one at http://mozilla.org/MPL/2.0/.
 * ------------------------------------------------------------------*/

package com.kotlinnlp.simplednn.core.arrays

import com.kotlinnlp.simplednn.simplemath.ndarray.dense.DenseNDArray
import com.kotlinnlp.simplednn.simplemath.ndarray.dense.DenseNDArrayFactory
import com.kotlinnlp.simplednn.simplemath.ndarray.Shape

/**
 * The [UpdatableDenseArray] is a wrapper of a [DenseNDArray]
 */
open class UpdatableDenseArray(override val values: DenseNDArray) : UpdatableArray<DenseNDArray>(values = values) {

  /**
   * Build an [UpdatableDenseArray] with values initialized to zeros.
   *
   * @param shape the shape of the [values] array
   *
   * @return a new array with values initialized to zeros
   */
  constructor(shape: Shape) : this(DenseNDArrayFactory.zeros(shape))

  /**
   * Build an [UpdatableDenseArray] with values initialized to zeros.
   *
   * @param dim1 the first dimension of the array
   * @param dim2 the second dimension of the array (default = 1)
   *
   * @return a new dense array with values initialized to zeros
   */
  constructor(dim1: Int, dim2: Int = 1) : this(Shape(dim1, dim2))

  companion object {

{'fraction_non_alphanumeric': 0.1356521739130435, 'fraction_numerical': 0.011130434782608696, 'mean_word_length': 3.1381294964028776, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1795219', 'n_tokens_mistral': 909, 'n_tokens_neox': 860, 'n_words': 282}