public fun PlotBunch . save ( filename : String , scale : Number = <NUM_LIT:1> , dpi : Number ? = null , path : String ? = null ) : String

/**
 * Exports a plot bunch to a file in one of the supported formats: `SVG`, `HTML`, `PNG`, `JPG`/`JPEG`, or `TIFF`.
 *
 * > In certain configurations, raster formats might not be supported.
 *
 * The exported file will be created in the directory `${user.dir}/lets-plot-images`,
 * unless a different directory is specified using the [path] parameter.
 *
 * @receiver [Plot] - the plot to export.
 * @param filename the name of the output file.
 * The filename must include an extension corresponding to one of the supported formats:
 * **svg**, **html** (or **htm**), **png**, **jpeg** (or **jpg**), or **tiff** (or **tif**).
 * @param scale The scaling is applied to the plot when exporting to raster formats (`PNG`, `JPEG`, `TIFF`).
 * This parameter is ignored for vector formats (`SVG`, `HTML`).
 * The default value is 1.
 * @param dpi the resolution of the exported image in dots per inch (DPI) when exporting to raster formats.
 * This parameter is ignored for vector formats.
 * By default, no DPI metadata is stored in the file.
 * @param path the path to the directory where the image files will be saved.
 * If not specified, the default directory is `${user.dir}/lets-plot-images`.
 *
 * @return The absolute pathname of the created file.
 */


public fun rewrite ( arguments : List < String > , typeArguments : List < String > ) : String

/**
 *
 * A value argument and type arguments represents a string from source code in [arguments] and [typeArguments]
 * E.g., `f(1, "s")` will be passed to [rewrite] as `"1"` and `"\"s\""`
 *
 * In the case of a [trailing lambda](https://kotlinlang.org/docs/lambdas.html#passing-trailing-lambdas),
 * it will be passed as it in the last element of [arguments]
 * E.g., the snippet `f(0) { i++ }` will have `"0"` and `"{ i++ }"` arguments
 *
 * @param arguments a list of arguments represented as a string from source code
 * _Note:_ en empty string is possible, e.g. for `fun f(,,,)`
 * @param typeArguments a list of type parameters represented as a string from source code
 * _Note:_ en empty string is possible
 *
 * @return a string or an empty string to delete the call expression
 */


public fun rewriteImportDirective ( importPath : String ) : String ?

= importPath

/**
 * Allows to rewrite paths of [import directives](https://kotlinlang.org/spec/packages-and-imports.html#importing)
 * E.g., for `import org.example` the path `org.example` will be used as an argument of [rewriteImportDirective]
 *
 * The default implementation is the identity function that return unchanged an import path
 *
 * @param importPath a path of value of import directive
 *
 * @return a string or `null` to delete a whole import directive in [SampleSnippet.imports]
 *
 * @see SampleSnippet.imports
 */


public fun getFunctionCallRewriter ( name : String ) : FunctionCallRewriter ?

/**
 * Allows to rewrite a function call expressions
 * It also includes calls of constructors
 *
 * @return [FunctionCallRewriter] or null if a call should be left unchanged
 */


fun targetDependency ( target : TargetWithSanitizer = TargetWithSanitizer . host ) : Buildable

= <EOL> nativeDependencies . incoming . artifactView { <EOL> attributes { <EOL> attribute ( TargetWithSanitizer . TARGET_ATTRIBUTE , target ) <EOL> } <EOL> } . files

/**
 * Dependency on [target] platform.
 */


fun targetDependency ( target : KonanTarget ) : Buildable

= targetDependency ( target . withSanitizer ( ) )


private fun handleClassAnnotations ( classSymbol : Symbol . ClassSymbol )

{ <EOL> elementUtils . getAllAnnotationMirrors ( classSymbol ) . forEach { <EOL> ( it . annotationType . asElement ( ) as? TypeElement ) ? . let { <EOL> sourceStructure . addMentionedAnnotations ( it . qualifiedName . toString ( ) ) <EOL> } <EOL> } <EOL> }

/** Handle annotations on this class, including the @Inherited ones as those are not visible using Tree APIs. */


private fun IrStatementsBuilder < * > . addAndGetLastExpression ( blockBuilder : IrBlockBodyBuilder . ( ) -> Unit ) : IrExpression

{ <EOL> val irBlockBody = irBlockBody ( startOffset , endOffset , blockBuilder ) <EOL> irBlockBody . statements . dropLast ( <NUM_LIT:1> ) . forEach { + it } <EOL> return irBlockBody . statements . last ( ) as? IrExpression <EOL> ? : error ( "<STR_LIT>" ) <EOL> }

/**
 * Add all statements to the builder, except the last one.
 * The last statement should be an expression, it will return as a result
 */


fun File . setFileContent ( content : String )

{ <EOL> check ( ! exists ( ) ) { <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> readText ( ) + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> content + <EOL> "<STR_LIT>" <EOL> } <EOL> parentFile . mkdirs ( ) <EOL> writeText ( content ) <EOL> }

/**
 * Set required content for [this] [File].
 */


public abstract fun apply ( tf : Ops , yPred : Operand < Float > , yTrue : Operand < Float > , numberOfLosses : Operand < Float > ? <EOL> ) : Operand < Float >

/**
 * Applies [LossFunction] to the [yPred] labels predicted by the model and known [yTrue] hidden during training.
 *
 * @param yPred The predicted values. shape = `[batch_size, d0, .. dN]`.
 * @param yTrue Ground truth values. Shape = `[batch_size, d0, .. dN]`, except
 * sparse loss functions such as sparse categorical crossentropy where
 * shape = `[batch_size, d0, .. dN-1]`.
 * @param [tf] TensorFlow graph API for building operations.
 */


fun register ( @ TestDataFile testDataFilePath : String , sourceTransformer : ExternalSourceTransformer )

{ <EOL> registeredSourceTransformers . computeIfAbsent ( getAbsoluteFile ( testDataFilePath ) ) { mutableListOf ( ) } += sourceTransformer <EOL> }

/**
 * Called directly from test class constructor.
 */


@ Test <EOL> fun `test single native target in hierarchy` ( )

{ <EOL> val result = commonize { <EOL> outputTarget ( "<STR_LIT:(aU+002CU+0020b)>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> simpleSingleSourceTarget ( "<STR_LIT:a>" , """<STR_LIT>""" ) <EOL> } <EOL> result . assertCommonized ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> result . assertCommonized ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> }

/**
 * Following the simple design principle:
 * Absent/Unsupported targets shall result in the same output as a request only mentioning supported targets
 */


private fun tryResolveMarkerInterfaceFQName ( classId : ClassId ) : String ?

{ <EOL> for ( mapping in JavaToKotlinClassMap . mutabilityMappings ) { <EOL> if ( mapping . kotlinReadOnly == classId ) { <EOL> return "<STR_LIT>" <EOL> } else if ( mapping . kotlinMutable == classId ) { <EOL> return "<STR_LIT>" + classId . relativeClassName . asString ( ) <EOL> . replace ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> . replace ( "<STR_LIT:.>" , "<STR_LIT:$>" ) <EOL> } <EOL> } <EOL> return null <EOL> }

/***
 * @see org.jetbrains.kotlin.codegen.ImplementationBodyCodegen
 */


protected fun initParentJob ( parent : Job ? )

{ <EOL> assert { parentHandle == null } <EOL> if ( parent == null ) { <EOL> parentHandle = NonDisposableHandle <EOL> return <EOL> } <EOL> parent . start ( ) <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> val handle = parent . attachChild ( this ) <EOL> parentHandle = handle <EOL> if ( isCompleted ) { <EOL> handle . dispose ( ) <EOL> parentHandle = NonDisposableHandle <EOL> } <EOL> }

/**
 * Initializes parent job.
 * It shall be invoked at most once after construction after all other initialization.
 */


private inline fun loopOnState ( block : ( Any ? ) -> Unit ) : Nothing

{ <EOL> while ( true ) { <EOL> block ( state ) <EOL> } <EOL> }

/**
 * @suppress **This is unstable API and it is subject to change.**
 */


private fun cancelParent ( cause : Throwable ) : Boolean

{ <EOL> if ( isScopedCoroutine ) return true <EOL> val isCancellation = cause is CancellationException <EOL> val parent = parentHandle <EOL> if ( parent === null || parent === NonDisposableHandle ) { <EOL> return isCancellation <EOL> } <EOL> return parent . childCancelled ( cause ) || isCancellation <EOL> }

/**
 * The method that is invoked when the job is cancelled to possibly propagate cancellation to the parent.
 * Returns `true` if the parent is responsible for handling the exception, `false` otherwise.
 *
 * Invariant: never returns `false` for instances of [CancellationException], otherwise such exception
 * may leak to the [CoroutineExceptionHandler].
 */


/**
 * Override to provide the actual [start] action.
 * This function is invoked exactly once when non-active coroutine is [started][start].
 */


internal fun removeNode ( node : JobNode )

{ <EOL> loopOnState { state -> <EOL> when ( state ) { <EOL> is JobNode -> { <EOL> if ( state !== node ) return <EOL> if ( _state . compareAndSet ( state , EMPTY_ACTIVE ) ) return <EOL> } <EOL> is Incomplete -> { <EOL> if ( state . list != null ) node . remove ( ) <EOL> return <EOL> } <EOL> else -> return <EOL> } <EOL> } <EOL> }


public open fun childCancelled ( cause : Throwable ) : Boolean

{ <EOL> if ( cause is CancellationException ) return true <EOL> return cancelImpl ( cause ) && handlesException <EOL> }

/**
 * Child was cancelled with a cause.
 * In this method parent decides whether it cancels itself (e.g. on a critical failure) and whether it handles the exception of the child.
 * It is overridden in supervisor implementations to completely ignore any child cancellation.
 * Returns `true` if exception is handled, `false` otherwise (then caller is responsible for handling an exception)
 *
 * Invariant: never returns `false` for instances of [CancellationException], otherwise such exception
 * may leak to the [CoroutineExceptionHandler].
 */


public fun cancelCoroutine ( cause : Throwable ? ) : Boolean

= cancelImpl ( cause )

/**
 * Makes this [Job] cancelled with a specified [cause].
 * It is used in [AbstractCoroutine]-derived classes when there is an internal failure.
 */


internal fun makeCompleting ( proposedUpdate : Any ? ) : Boolean

{ <EOL> loopOnState { state -> <EOL> val finalState = tryMakeCompleting ( state , proposedUpdate ) <EOL> when { <EOL> finalState === COMPLETING_ALREADY -> return false <EOL> finalState === COMPLETING_WAITING_CHILDREN -> return true <EOL> finalState === COMPLETING_RETRY -> return@loopOnState <EOL> else -> { <EOL> afterCompletion ( finalState ) <EOL> return true <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Completes this job. Used by [CompletableDeferred.complete] (and exceptionally)
 * and by [JobImpl.cancel]. It returns `false` on repeated invocation
 * (when this job is already completing).
 */


internal fun makeCompletingOnce ( proposedUpdate : Any ? ) : Any ?

{ <EOL> loopOnState { state -> <EOL> val finalState = tryMakeCompleting ( state , proposedUpdate ) <EOL> when { <EOL> finalState === COMPLETING_ALREADY -> <EOL> throw IllegalStateException ( "<STR_LIT>" + "<STR_LIT>" , proposedUpdate . exceptionOrNull ) <EOL> finalState === COMPLETING_RETRY -> return@loopOnState <EOL> else -> return finalState <EOL> } <EOL> } <EOL> }

/**
 * Completes this job. Used by [AbstractCoroutine.resume].
 * It throws [IllegalStateException] on repeated invocation (when this job is already completing).
 * Returns:
 * - [COMPLETING_WAITING_CHILDREN] if started waiting for children.
 * - Final state otherwise (caller should do [afterCompletion])
 */


internal open fun handleOnCompletionException ( exception : Throwable )

{ <EOL> throw exception <EOL> }

/**
 * Override to process any exceptions that were encountered while invoking completion handlers
 * installed via [invokeOnCompletion].
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


protected open fun onCancelling ( cause : Throwable ? )

/**
 * This function is invoked once as soon as this job is being cancelled for any reason or completes,
 * similarly to [invokeOnCompletion] with `onCancelling` set to `true`.
 *
 * The meaning of [cause] parameter:
 * - Cause is `null` when the job has completed normally.
 * - Cause is an instance of [CancellationException] when the job was cancelled _normally_.
 * **It should not be treated as an error**. In particular, it should not be reported to error logs.
 * - Otherwise, the job had been cancelled or failed with exception.
 *
 * The specified [cause] is not the final cancellation cause of this job.
 * A job may produce other exceptions while it is failing and the final cause might be different.
 *
 * @suppress **This is unstable API and it is subject to change.*
 */


protected open fun handleJobException ( exception : Throwable ) : Boolean

= false

/**
 * Handles the final job [exception] that was not handled by the parent coroutine.
 * Returns `true` if it handles exception (so handling at later stages is not needed).
 * It is designed to be overridden by launch-like coroutines
 * (`StandaloneCoroutine` and `ActorCoroutine`) that don't have a result type
 * that can represent exceptions.
 *
 * This method is invoked **exactly once** when the final exception of the job is determined
 * and before it becomes complete. At the moment of invocation the job and all its children are complete.
 */


protected open fun onCompletionInternal ( state : Any ? )

/**
 * Override for completion actions that need to update some external object depending on job's state,
 * right before all the waiters for coroutine's completion are notified.
 *
 * @param state the final state.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


protected open fun afterCompletion ( state : Any ? )

/**
 * Override for the very last action on job's completion to resume the rest of the code in
 * scoped coroutines. It is called when this job is externally completed in an unknown
 * context and thus should resume with a default mode.
 *
 * @suppress **This is unstable API and it is subject to change.**
 */


internal open fun nameString ( ) : String

= classSimpleName


internal fun getCompletedInternal ( ) : Any ?

{ <EOL> val state = this . state <EOL> check ( state !is Incomplete ) { "<STR_LIT>" } <EOL> if ( state is CompletedExceptionally ) throw state . cause <EOL> return state . unboxState ( ) <EOL> }


protected suspend fun awaitInternal ( ) : Any ?

{ <EOL> while ( true ) { <EOL> val state = this . state <EOL> if ( state !is Incomplete ) { <EOL> if ( state is CompletedExceptionally ) { <EOL> recoverAndThrow ( state . cause ) <EOL> } <EOL> return state . unboxState ( ) <EOL> } <EOL> if ( startInternal ( state ) >= <NUM_LIT:0> ) break <EOL> } <EOL> return awaitSuspend ( ) <EOL> }


fun loadActual ( ) : Attrs ?

/**
 * Load actual cache attribute values.
 * `null` means that cache is not yet created.
 *
 * This is internal operation that should be implemented by particular implementation of CacheAttributesManager.
 * Consider using `loadDiff().actual` for getting actual values.
 */


fun writeVersion ( values : Attrs ? = expected )

/**
 * Write [values] as cache attributes for next build execution.
 */


fun isCompatible ( actual : Attrs , expected : Attrs ) : Boolean

= actual == expected

/**
 * Check if cache with [actual] attributes values can be used when [expected] attributes are required.
 */


fun FirEnumEntry . hasBody ( ) : Boolean ?

/**
 * Returns whether this [FirEnumEntry] has a body in source, or `null` if the entry does not have a source.
 *
 * Returns `false` if entry has a constructor call, but doesn't have a body:
 * ```kotlin
 * enum class E(i: Int) { FOO(42) }
 * ```
 *
 * We have to go down to source level, since this cannot be checked only by FIR element. This is because in FIR all enum entries
 * with constructor calls have a fake [FirEnumEntry.initializer] with an anonymous object, regardless of whether the entry had
 * body originally.
 */


fun FirEnumEntry . hasInitializer ( ) : Boolean ?

/**
 * Returns whether this [FirEnumEntry] has an initializer in source, or `null` if the entry does not have a source.
 *
 * Reason of implementing this in [SourceNavigator] and not in FIR is same as in [hasBody] method.
 */


@ Throws ( IOException :: class ) <EOL> public fun instrument ( originalClass : InputStream , debugName : String ) : ByteArray

/**
 * Modify byte code of single class-file to measure the coverage of this class.
 *
 * @param originalClass input stream with byte code of original class-file
 * @param debugName name of the class or class-file, which is used in the error message
 * @return instrumented byte code
 * @throws IOException in case of any instrumentation error
 */


{ <EOL> val preprocessing = pipeline < BufferedImage > ( ) <EOL> . convert { colorMode = ColorMode . BGR } <EOL> . toFloatArray { } <EOL> . rescale { <EOL> scalingCoefficient = <NUM_LIT> <EOL> } <EOL> val ( cifarImagesArchive , cifarLabelsArchive ) = cifar10Paths ( ) <EOL> val y = extractCifar10LabelsAnsSort ( cifarLabelsArchive ) <EOL> val dataset = OnFlyImageDataset . create ( File ( cifarImagesArchive ) , y , preprocessing ) <EOL> val ( train , test ) = dataset . split ( TRAIN_TEST_SPLIT_RATIO ) <EOL> vgg11 . use { <EOL> it . compile ( optimizer = Adam ( ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> it . logSummary ( ) <EOL> val start = System . currentTimeMillis ( ) <EOL> it . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> println ( "<STR_LIT>" ) <EOL> it . save ( File ( PATH_TO_MODEL ) , writingMode = WritingMode . OVERRIDE ) <EOL> val accuracy = it . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * This example shows how to do image classification from scratch, starting from Cifar'10 dataset image files, using [vgg11] model.
 *
 * It includes:
 * - dataset loading from S3
 * - dataset splitting
 * - model compilation
 * - model training
 * - model evaluation
 */


= vgg ( )


private fun fillLookupStorage ( projectRoot : File , reverseFiles : Boolean , reverseLookups : Boolean , storeFullFqNames : Boolean = false )

{ <EOL> val storageRoot = projectRoot . storageRoot <EOL> val fileToPathConverter = RelativeFileToPathConverter ( projectRoot ) <EOL> val icContext = IncrementalCompilationContext ( pathConverterForSourceFiles = fileToPathConverter , storeFullFqNamesInLookupCache = storeFullFqNames , ) <EOL> val lookupStorage = LookupStorage ( storageRoot , icContext ) <EOL> val files = LinkedHashSet < String > ( ) <EOL> val symbols = LinkedHashSet < LookupSymbol > ( ) <EOL> val lookups = MultiMap . createOrderedSet < LookupSymbol , String > ( ) <EOL> for ( i in <NUM_LIT:0> .. <NUM_LIT:10> ) { <EOL> val newSymbol = LookupSymbol ( name = "<STR_LIT>" , scope = "<STR_LIT>" ) <EOL> val newSourcePath = projectRoot . resolve ( "<STR_LIT>" ) . canonicalFile . invariantSeparatorsPath <EOL> symbols . add ( newSymbol ) <EOL> for ( lookedUpSymbol in symbols ) { <EOL> lookups . putValue ( lookedUpSymbol , newSourcePath ) <EOL> } <EOL> files . add ( newSourcePath ) <EOL> } <EOL> val filesToAdd = if ( reverseFiles ) files . reversedSet ( ) else files <EOL> val lookupsToAdd = if ( reverseLookups ) lookups . reversedMultiMap ( ) else lookups <EOL> lookupStorage . addAll ( lookupsToAdd , filesToAdd ) <EOL> lookupStorage . flush ( ) <EOL> }

/**
 * Fills lookup storage in [projectRoot] with N fq-names,
 * where i_th fq-name myscope_i.MyClass_i has lookups for previous fq-names (from 0 to i-1)
 */


fun getter ( container : Object ) : Field ?

/**
 * The value of the field in the given object, or `null` if the field is not set.
 */


fun getterNotNull ( container : Object ) : Field

= <EOL> getter ( container ) ? : throw IllegalStateException ( "<STR_LIT>" )

/**
 * Function that returns the value of the field in the given object,
 * or throws [IllegalStateException] if the field is not set.
 *
 * This function is used to access fields during formatting.
 */


fun isZero ( obj : Target ) : Boolean

/**
 * A check for whether the current value of the field is zero.
 */


fun reifyInstructions ( node : MethodNode ) : ReifiedTypeParametersUsages

{ <EOL> if ( ! hasReifiedParameters ) return ReifiedTypeParametersUsages ( ) <EOL> val instructions = node . instructions <EOL> maxStackSize = <NUM_LIT:0> <EOL> val result = ReifiedTypeParametersUsages ( ) <EOL> for ( insn in instructions . toArray ( ) ) { <EOL> if ( isOperationReifiedMarker ( insn ) ) { <EOL> val newNames = processReifyMarker ( insn as MethodInsnNode , instructions ) <EOL> if ( newNames != null ) { <EOL> result . mergeAll ( newNames ) <EOL> } <EOL> } <EOL> } <EOL> node . maxStack = node . maxStack + maxStackSize <EOL> return result <EOL> }

/**
 * @return set of type parameters' identifiers contained in markers that should be reified further
 * e.g. when we're generating inline function containing reified T
 * and another function containing reifiable parts is inlined into that function
 */


private fun isPluginNext ( insn : AbstractInsnNode ) : Boolean

{ <EOL> val magicInsn = insn . next ? . next ? . next ? : return false <EOL> return magicInsn is MethodInsnNode && magicInsn . opcode == Opcodes . INVOKESTATIC <EOL> && magicInsn . owner == pluginIntrinsicsMarkerOwner <EOL> && magicInsn . name == pluginIntrinsicsMarkerMethod <EOL> && magicInsn . desc == pluginIntrinsicsMarkerSignature <EOL> && magicInsn . previous is LdcInsnNode <EOL> }

/** insn: INVOKESTATIC reifiedOperationMarker
 * insn.next: operation to be reified
 * insn.next.next: ldc(pluginMarker)
 * insn.next.next.next: INVOKESTATIC voidMagicApiCall
 */


protected open fun superTypeToSymbols ( typeRef : FirTypeRef ) : Collection < FirClassifierSymbol < * > >

{ <EOL> return listOfNotNull ( typeRef . coneType . toSymbol ( session ) ) <EOL> }

/**
 * @return symbols which should be resolved to [FirResolvePhase.STATUS] phase
 */


fun createValidityTracker ( ) : ModificationTracker

= LLFirSessionValidityModificationTracker ( WeakReference ( this ) )

/**
 * Creates a [ModificationTracker] which tracks the validity of this session via [isValid].
 */


= lazyDisposable . value

/**
 * Returns an already registered [Disposable] which is alive until the session is invalidated. It can be used as a parent disposable for
 * disposable session components, such as [resolve extensions][org.jetbrains.kotlin.analysis.api.resolve.extensions.KtResolveExtension].
 * When the session is invalidated or garbage-collected, all disposable session components will be disposed with this parent disposable.
 *
 * Because not all sessions have disposable components, this disposable is created and registered on-demand with the first call to
 * [requestDisposable]. This avoids polluting [Disposer] with unneeded disposables.
 *
 * The disposable must only be requested during session creation, before the session is added to [LLFirSessionCache].
 */


fun < T > Collection < T > . bfs ( getNeighbors : ( T ) -> Iterator < T > ) : Sequence < T >

{ <EOL> val queue = ArrayDeque ( this ) <EOL> val visited = mutableSetOf < T > ( ) <EOL> return sequence { <EOL> while ( queue . isNotEmpty ( ) ) { <EOL> val current = queue . removeFirst ( ) <EOL> if ( current in visited ) continue <EOL> visited . add ( current ) <EOL> yield ( current ) <EOL> getNeighbors ( current ) . forEach ( queue :: add ) <EOL> } <EOL> } <EOL> }

/**
 * Perform BFS on the given collection with neighbors created by the given function.
 */


/**
 * [kotlin.collections.A<caret>rrayList]
 */


fun TestDokkaConfiguration . toDokkaConfiguration ( projectDir : File ) : DokkaConfiguration

{ <EOL> require ( projectDir . exists ( ) && projectDir . isDirectory ) { <EOL> "<STR_LIT>" <EOL> } <EOL> val moduleName = this . moduleName <EOL> val includes = this . includes . mapToSet { it . relativeTo ( projectDir ) } <EOL> val sourceSets = this . sourceSets . map { it . toDokkaSourceSet ( projectDir ) } <EOL> return object : DokkaConfiguration { <EOL> override val moduleName : String <EOL> get ( ) = moduleName <EOL> override val includes : Set < File > <EOL> get ( ) = includes <EOL> override val sourceSets : List < DokkaConfiguration . DokkaSourceSet > <EOL> get ( ) = sourceSets <EOL> override val pluginsClasspath : List < File > <EOL> get ( ) = emptyList ( ) <EOL> override val pluginsConfiguration : List < DokkaConfiguration . PluginConfiguration > <EOL> get ( ) = emptyList ( ) <EOL> override val moduleVersion : String <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val outputDir : File <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val cacheRoot : File <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val offlineMode : Boolean <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val failOnWarning : Boolean <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val modules : List < DokkaConfiguration . DokkaModuleDescription > <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val delayTemplateSubstitution : Boolean <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val suppressObviousFunctions : Boolean <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val suppressInheritedMembers : Boolean <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> override val finalizeCoroutines : Boolean <EOL> get ( ) = throw NotImplementedError ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Maps [TestDokkaConfiguration] to the actual [DokkaConfiguration] that will
 * be used to run Dokka; The resulting configuration must be valid from Dokka's perspective.
 *
 * @receiver test configuration to map to the real one; all file paths must be relative to the
 * root of the project.
 * @param projectDir the actual project directory that will be used to create test files in;
 * the path must be absolute and must exist.
 */


@ Test <EOL> fun createZeroFilledByteArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < Byte > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:0> . toByte ( ) } } <EOL> }

/**
 * This method checks if a byte array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createByteArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < Byte > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:1> . toByte ( ) } } <EOL> }

/**
 * Creates a byte array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> fun createNDimensionalArrayFromByteSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . map { it . toByte ( ) } . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < Byte , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of bytes
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveByteArray ( )

{ <EOL> val array = ByteArray ( <NUM_LIT> ) { random . nextInt ( <NUM_LIT> ) . toByte ( ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive ByteArray
 * and checks if the array's ByteArray representation matches the input ByteArray.
 */


@ Test <EOL> @ Ignore <EOL> fun createByteNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . dnarray < Byte > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { ( it + <NUM_LIT:3> ) . toByte ( ) } <EOL> val expected = byteArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's ByteArray representation matches the expected output.
 */


@ Test <EOL> fun createByteNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < Byte > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { ( it + <NUM_LIT:3> ) . toByte ( ) } <EOL> val expected = byteArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }


@ Test <EOL> fun createZeroFilledShortArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < Short > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:0> . toShort ( ) } } <EOL> }

/**
 * This method checks if a short array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createShortArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < Short > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:1> . toShort ( ) } } <EOL> }

/**
 * Creates a short array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> @ Ignore <EOL> fun createNDimensionalArrayFromShortSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . map { it . toShort ( ) } . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < Short , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of shorts
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveShortArray ( )

{ <EOL> val array = ShortArray ( <NUM_LIT> ) { random . nextInt ( <NUM_LIT> ) . toShort ( ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive ShortArray
 * and checks if the array's ShortArray representation matches the input ShortArray.
 */


@ Test <EOL> fun createShortNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . d4array < Short > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { ( it + <NUM_LIT:3> ) . toShort ( ) } <EOL> val expected = shortArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's ShortArray representation matches the expected output.
 */


@ Test <EOL> fun createShortNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < Short > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { ( it + <NUM_LIT:3> ) . toShort ( ) } <EOL> val expected = shortArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }


@ Test <EOL> fun createZeroFilledIntArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < Int > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:0> } } <EOL> }

/**
 * This method checks if an integer array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createIntArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < Int > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:1> } } <EOL> }

/**
 * Creates an integer array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> fun createNDimensionalArrayFromIntSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < Int , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of integers
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveIntArray ( )

{ <EOL> val array = IntArray ( <NUM_LIT> ) { random . nextInt ( <NUM_LIT> ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive IntArray
 * and checks if the array's IntArray representation matches the input IntArray.
 */


@ Test <EOL> @ Ignore <EOL> fun createIntNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . dnarray < Int > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { ( it + <NUM_LIT:3> ) } <EOL> val expected = intArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's IntArray representation matches the expected output.
 */


@ Test <EOL> fun createIntNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < Int > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { it + <NUM_LIT:3> } <EOL> val expected = intArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }


@ Test <EOL> fun createZeroFilledLongArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < Long > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:0L> } } <EOL> }

/**
 * This method checks if a long array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createLongArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < Long > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:1L> } } <EOL> }

/**
 * Creates a long array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> fun createNDimensionalArrayFromLongSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . map { it . toLong ( ) } . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < Long , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of longs
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveLongArray ( )

{ <EOL> val array = LongArray ( <NUM_LIT> ) { random . nextLong ( <NUM_LIT> ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive LongArray
 * and checks if the array's LongArray representation matches the input LongArray.
 */


@ Test <EOL> @ Ignore <EOL> fun createLongNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . dnarray < Long > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { it + <NUM_LIT:3L> } <EOL> val expected = longArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's LongArray representation matches the expected output.
 */


@ Test <EOL> fun createLongNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < Long > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { it + <NUM_LIT:3L> } <EOL> val expected = longArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:10> , <NUM_LIT:11> , <NUM_LIT:12> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT:16> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }


@ Test <EOL> fun createZeroFilledFloatArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < Float > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT> } } <EOL> }

/**
 * This method checks if a float array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createFloatArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < Float > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT> } } <EOL> }

/**
 * Creates a float array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> fun createNDimensionalArrayFromFloatSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . map { it . toFloat ( ) } . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < Float , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of floats
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveFloatArray ( )

{ <EOL> val array = FloatArray ( <NUM_LIT> ) { random . nextFloat ( ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive FloatArray
 * and checks if the array's FloatArray representation matches the input FloatArray.
 */


@ Test <EOL> @ Ignore <EOL> fun createFloatNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . dnarray < Float > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { it + <NUM_LIT> } <EOL> val expected = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's FloatArray representation matches the expected output.
 */


@ Test <EOL> fun createFloatNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < Float > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { it + <NUM_LIT> } <EOL> val expected = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }


@ Test <EOL> fun createZeroFilledDoubleArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < Double > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:0.0> } } <EOL> }

/**
 * This method checks if a double array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createDoubleArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < Double > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == <NUM_LIT:1.0> } } <EOL> }

/**
 * Creates a double array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> fun createNDimensionalArrayFromDoubleSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . map { it . toDouble ( ) } . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < Double , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of doubles
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveDoubleArray ( )

{ <EOL> val array = DoubleArray ( <NUM_LIT> ) { random . nextDouble ( <NUM_LIT> ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive DoubleArray
 * and checks if the array's DoubleArray representation matches the input DoubleArray.
 */


@ Test <EOL> @ Ignore <EOL> fun createDoubleNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . dnarray < Double > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { it + <NUM_LIT:3.0> } <EOL> val expected = doubleArrayOf ( <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's DoubleArray representation matches the expected output.
 */


@ Test <EOL> fun createDoubleNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < Double > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { it + <NUM_LIT:3.0> } <EOL> val expected = <EOL> doubleArrayOf ( <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }


@ Test <EOL> fun createZeroFilledComplexFloatArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < ComplexFloat > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == ComplexFloat . zero } } <EOL> }

/**
 * This method checks if a ComplexFloat array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createComplexFloatArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < ComplexFloat > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == ComplexFloat . one } } <EOL> }

/**
 * Creates a ComplexFloat array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> fun createNDimensionalArrayFromComplexFloatSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . map { ComplexFloat ( it , it + <NUM_LIT:1> ) } . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < ComplexFloat , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of complex floats
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveComplexFloatArray ( )

{ <EOL> val array = ComplexFloatArray ( <NUM_LIT> ) { ComplexFloat ( random . nextFloat ( ) , random . nextFloat ( ) ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getComplexFloatArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive ComplexFloatArray
 * and checks if the array's ComplexFloatArray representation matches the input ComplexFloatArray.
 */


@ Test <EOL> @ Ignore <EOL> fun createComplexFloatNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . dnarray < ComplexFloat > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { ComplexFloat ( it + <NUM_LIT> , round ( ( it - <NUM_LIT> ) * <NUM_LIT> ) / <NUM_LIT> ) } <EOL> val expected = complexFloatArrayOf ( <NUM_LIT> - <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexFloatArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's ComplexFloatArray representation matches the expected output.
 */


@ Test <EOL> fun createComplexFloatNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < ComplexFloat > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { ComplexFloat ( it + <NUM_LIT> , round ( ( it - <NUM_LIT> ) * <NUM_LIT> ) / <NUM_LIT> ) } <EOL> val expected = complexFloatArrayOf ( <NUM_LIT> - <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexFloatArray ( ) shouldBe expected <EOL> }


@ Test <EOL> fun createZeroFilledComplexDoubleArray ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . zeros < ComplexDouble > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == ComplexDouble . zero } } <EOL> }

/**
 * This method checks if a ComplexDouble array of a given size is correctly created with all elements set to zero.
 */


@ Test <EOL> fun createComplexDoubleArrayFilledWithOnes ( )

{ <EOL> val dim1 = <NUM_LIT:5> <EOL> val dim2 = <NUM_LIT:7> <EOL> val dim3 = <NUM_LIT:3> <EOL> val dim4 = <NUM_LIT:2> <EOL> val dim5 = <NUM_LIT:3> <EOL> val a = mk . ones < ComplexDouble > ( dim1 , dim2 , dim3 , dim4 , dim5 ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . size ) <EOL> assertEquals ( dim1 * dim2 * dim3 * dim4 * dim5 , a . data . size ) <EOL> assertTrue { a . all { it == ComplexDouble . one } } <EOL> }

/**
 * Creates a ComplexDouble array filled with ones of a given size and checks if all elements are set to one.
 */


@ Test <EOL> fun createNDimensionalArrayFromComplexDoubleSet ( )

{ <EOL> val set = ( <NUM_LIT:1> .. <NUM_LIT> ) . map { ComplexDouble ( it , it + <NUM_LIT:1> ) } . toSet ( ) <EOL> val shape = intArrayOf ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> val a = mk . ndarray < ComplexDouble , DN > ( set , shape = shape ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

/**
 * Creates an n-dimensional array from a set of complex doubles
 * and checks if the array's set representation matches the input set.
 */


@ Test <EOL> fun createNDimensionalArrayFromPrimitiveComplexDoubleArray ( )

{ <EOL> val array = ComplexDoubleArray ( <NUM_LIT> ) { ComplexDouble ( random . nextDouble ( <NUM_LIT> ) , random . nextDouble ( <NUM_LIT> ) ) } <EOL> val a = mk . ndarray ( array , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getComplexDoubleArray ( ) shouldBe array <EOL> }

/**
 * Creates an n-dimensional array from a primitive ComplexDoubleArray
 * and checks if the array's ComplexDoubleArray representation matches the input ComplexDoubleArray.
 */


@ Test <EOL> @ Ignore <EOL> fun createComplexDoubleNDArrayWithInitializationFunctionWith4D ( )

{ <EOL> val a = mk . dnarray < ComplexDouble > ( <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:1> , <NUM_LIT:2> ) { ComplexDouble ( it + <NUM_LIT> , round ( ( it - <NUM_LIT> ) * <NUM_LIT> ) / <NUM_LIT> ) } <EOL> val expected = complexDoubleArrayOf ( <NUM_LIT> - <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Creates an n-dimensional array with a given size using an initialization function
 * and checks if the array's ComplexDoubleArray representation matches the expected output.
 */


@ Test <EOL> fun createComplexDoubleNDArrayWithInitializationFunctionWith5D ( )

{ <EOL> val a = mk . dnarray < ComplexDouble > ( <NUM_LIT:2> , <NUM_LIT:2> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:2> ) { ComplexDouble ( it + <NUM_LIT> , round ( ( it - <NUM_LIT> ) * <NUM_LIT> ) / <NUM_LIT> ) } <EOL> val expected = complexDoubleArrayOf ( <NUM_LIT> - <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i , <NUM_LIT> + <NUM_LIT> . i ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexDoubleArray ( ) shouldBe expected <EOL> }


public inline fun LayerCollectorContext . boxes ( block : BoxesContext . ( ) -> Unit )

{ <EOL> addLayer ( BoxesContext ( this ) . apply { <EOL> position = Position . dodge ( ) <EOL> } . apply ( block ) ) <EOL> }

/**
 * Adds a new `boxes` layer to the plot.
 *
 * The `boxes` layer is responsible for constructing a boxplot representation,
 * which visualizes the distribution of a dataset by depicting its quartiles
 * and thereby provides insights into the data's spread and potential skewness.
 *
 * This function creates a context where you can set aesthetic mappings (`aes`) or aesthetic constants.
 * - Mappings are specified by calling methods that correspond to aesthetic names (`aes`).
 * - Constants are directly assigned using properties with the names corresponding to aesthetics.
 * For positional aesthetics, you can use the `.constant()` method.
 *
 * ## Boxes Aesthetics
 * * **`x`** - The X-coordinate specifying the categories.
 * * **`yMin`** - The minimum value for the Y-coordinate (the lowest whisker).
 * * **`lower`** - The lower quartile value.
 * * **`middle`** - The median value.
 * * **`upper`** - The upper quartile value.
 * * **`yMax`** - The maximum value for the Y-coordinate (the highest whisker).
 * * **`fillColor`** - The fill color of the boxes.
 * * **`alpha`** - The transparency of the boxes.
 * * **`width`** - The width of the boxes.
 * * **`fatten`** - The factor by which to "fatten" the width of the notch relative to the body.
 * * **`borderLine.color`** - Color of the boxes borderline.
 * * **`borderLine.width`** - Width of the boxes borderline.
 * * **`borderLine.type`** - Type of the boxes borderline, such as dashed or dotted.
 *
 * ## Example
 *
 * ```kotlin
 * plot {
 * boxes {
 * // Positional mapping
 * x(listOf("A", "B", "C", "D"))
 * yMin(listOf(10, 20, 5, 12))
 * lower(listOf(20, 30, 12, 22))
 * middle(listOf(30, 40, 20, 35))
 * upper(listOf(40, 50, 35, 45))
 * yMax(listOf(50, 55, 40, 48))
 *
 * // Adjust the Y-axis
 * y.limits = 0.0..60.0
 *
 * // Non-positional settings
 * fatten = 0.8
 * width = 0.5
 *
 * // BorderLine settings
 * borderLine.width = .5
 *
 * // Non-positional mapping
 * fillColor = Color.BLUE
 * }
 * }
 * ```
 */


private suspend fun Project . setupPreMultiplatformStableDefaultDependsOnEdges ( )

= multiplatformExtension . targets <EOL> . flatMap { target -> target . compilations } <EOL> . forEach { compilation -> <EOL> val sourceSetTree = KotlinSourceSetTree . orNull ( compilation ) ? : return@forEach <EOL> val commonSourceSetName = lowerCamelCaseName ( "<STR_LIT:common>" , sourceSetTree . name ) <EOL> val commonSourceSet = multiplatformExtension . sourceSets . findByName ( commonSourceSetName ) ? : return@forEach <EOL> compilation . defaultSourceSet . dependsOn ( commonSourceSet ) <EOL> }

/**
 * Before 1.9.20 (and without any targetHierarchy applied), we just added default dependsOn
 * edges from 'main' compilations defaultSourceSets to 'commonMain' and
 * edges from 'test' compilations defaultSourceSets to 'commonTest
 */


public fun detectFaces ( image : I , topK : Int = <NUM_LIT:5> , iouThreshold : Float = <NUM_LIT> ) : List < DetectedObject >

{ <EOL> val detectedObjects = predict ( image ) <EOL> return suppressNonMaxBoxes ( detectedObjects , topK , iouThreshold ) <EOL> }

/**
 * Detects [topK] faces on the given [image]. If [topK] is negative all detected faces are returned.
 * @param [iouThreshold] threshold IoU value for the non-maximum suppression applied during postprocessing
 */


public fun suppressNonMaxBoxes ( boxes : List < DetectedObject > , topK : Int = - <NUM_LIT:1> , threshold : Float = <NUM_LIT> ) : List < DetectedObject >

{ <EOL> val sortedBoxes = boxes . toMutableList ( ) . apply { sortByDescending { it . probability } } <EOL> val result = mutableListOf < DetectedObject > ( ) <EOL> while ( sortedBoxes . isNotEmpty ( ) ) { <EOL> val box = sortedBoxes . removeFirst ( ) <EOL> result . add ( box ) <EOL> if ( topK > <NUM_LIT:0> && result . size >= topK ) break <EOL> sortedBoxes . removeIf { iou ( box , it ) >= threshold } <EOL> } <EOL> return result <EOL> }

/**
 * Performs non-maximum suppression to filter out boxes with the IoU greater than a threshold.
 *
 * @param [boxes] boxes to filter
 * @param [topK] how many boxes to include in the result. Negative or zero means to include everything.
 * @param [threshold] threshold IoU value
 */


public fun iou ( box1 : DetectedObject , box2 : DetectedObject ) : Float

{ <EOL> val xMin = max ( box1 . xMin , box2 . xMin ) <EOL> val yMin = max ( box1 . yMin , box2 . yMin ) <EOL> val xMax = min ( box1 . xMax , box2 . xMax ) <EOL> val yMax = min ( box1 . yMax , box2 . yMax ) <EOL> val overlap = ( xMax - xMin ) * ( yMax - yMin ) <EOL> return overlap / ( box1 . area ( ) + box2 . area ( ) - overlap + EPS ) <EOL> }

/**
 * Computes the intersection over union value for the [box1] and [box2].
 */


internal fun pinCurrentThreadToIsolatedCpu ( )

{ <EOL> val isolatedList = System . getenv ( "<STR_LIT>" ) <EOL> val othersList = System . getenv ( "<STR_LIT>" ) <EOL> println ( "<STR_LIT>" ) <EOL> if ( othersList != null ) { <EOL> updateAffinityOfAllProcesses ( othersList ) <EOL> } <EOL> if ( isolatedList != null ) { <EOL> updateCurrentThreadAffinity ( isolatedList ) <EOL> } <EOL> if ( othersList == null && isolatedList == null ) { <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Pins the current thread to an isolated CPU.
 *
 * This method attempts to pin the current thread to an isolated CPU if the environment variables
 * 'DOCKER_ISOLATED_CPUSET' and 'DOCKER_CPUSET' are set.
 *
 * On benchmark agents, those variables should be assigned to non-overlapping CPUSETs.
 * It allows us to reduce interference of the other processes and threads.
 *
 * Note: CPUSET is in a format compatible with 'taskset' command (e.g., "0-3,8")
 */


private fun updateCurrentThreadAffinity ( cpuList : String )

{ <EOL> val selfPid = CLibrary . INSTANCE . getpid ( ) <EOL> val selfTid = CLibrary . INSTANCE . gettid ( ) <EOL> println ( "<STR_LIT>" ) <EOL> ProcessBuilder ( ) . command ( "<STR_LIT>" , "<STR_LIT>" , cpuList , "<STR_LIT>" ) . inheritIO ( ) . start ( ) . waitFor ( ) <EOL> }

/**
 * Updates the CPU affinity of the current thread.
 */


private fun updateAffinityOfAllProcesses ( cpuList : String )

{ <EOL> println ( "<STR_LIT>" ) <EOL> val pidRegex = "<STR_LIT>" . toRegex ( ) <EOL> File ( "<STR_LIT>" ) . listFiles ( ) ? . forEach { <EOL> if ( it . resolve ( "<STR_LIT>" ) . exists ( ) && it . name . matches ( pidRegex ) ) { <EOL> ProcessBuilder ( ) . command ( "<STR_LIT>" , "<STR_LIT>" , cpuList , it . name ) . inheritIO ( ) . start ( ) . waitFor ( ) <EOL> } <EOL> } <EOL> }

/**
 * Updates the affinity of all processes in the system to the specified CPU list.
 *
 * This method iterates over all processes in the system and modifies their affinity
 * to the CPUs specified in the 'cpuList' parameter.
 */


{ <EOL> }


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . reader ( charset : Charset = Charsets . UTF_8 , vararg options : OpenOption ) : InputStreamReader

{ <EOL> return InputStreamReader ( Files . newInputStream ( this , * options ) , charset ) <EOL> }

/**
 * Returns a new [InputStreamReader] for reading the content of this file.
 *
 * @param charset character set to use for reading text, UTF-8 by default.
 * @param options options to determine how the file is opened.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . bufferedReader ( charset : Charset = Charsets . UTF_8 , bufferSize : Int = DEFAULT_BUFFER_SIZE , vararg options : OpenOption ) : BufferedReader

{ <EOL> return BufferedReader ( InputStreamReader ( Files . newInputStream ( this , * options ) , charset ) , bufferSize ) <EOL> }

/**
 * Returns a new [BufferedReader] for reading the content of this file.
 *
 * @param charset character set to use for reading text, UTF-8 by default.
 * @param bufferSize necessary size of the buffer.
 * @param options options to determine how the file is opened.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . writer ( charset : Charset = Charsets . UTF_8 , vararg options : OpenOption ) : OutputStreamWriter

{ <EOL> return OutputStreamWriter ( Files . newOutputStream ( this , * options ) , charset ) <EOL> }

/**
 * Returns a new [OutputStreamWriter] for writing the content of this file.
 *
 * @param charset character set to use for writing text, UTF-8 by default.
 * @param options options to determine how the file is opened.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . bufferedWriter ( charset : Charset = Charsets . UTF_8 , bufferSize : Int = DEFAULT_BUFFER_SIZE , vararg options : OpenOption ) : BufferedWriter

{ <EOL> return BufferedWriter ( OutputStreamWriter ( Files . newOutputStream ( this , * options ) , charset ) , bufferSize ) <EOL> }

/**
 * Returns a new [BufferedWriter] for writing the content of this file.
 *
 * @param charset character set to use for writing text, UTF-8 by default.
 * @param bufferSize necessary size of the buffer.
 * @param options options to determine how the file is opened.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . readBytes ( ) : ByteArray

{ <EOL> return Files . readAllBytes ( this ) <EOL> }

/**
 * Gets the entire content of this file as a byte array.
 *
 * It's not recommended to use this function on huge files.
 * It has an internal limitation of approximately 2 GB byte array size.
 * For reading large files or files of unknown size, open an [InputStream][Path.inputStream] and read blocks sequentially.
 *
 * @return the entire content of this file as a byte array.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . writeBytes ( array : ByteArray , vararg options : OpenOption ) : Unit

{ <EOL> Files . write ( this , array , * options ) <EOL> }

/**
 * Writes an [array] of bytes to this file.
 *
 * By default, the file will be overwritten if it already exists, but you can control this behavior
 * with [options].
 *
 * @param array byte array to write into this file.
 * @param options options to determine how the file is opened.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . appendBytes ( array : ByteArray )

{ <EOL> Files . write ( this , array , StandardOpenOption . APPEND ) <EOL> }

/**
 * Appends an [array] of bytes to the content of this file.
 *
 * @param array byte array to append to this file.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> public fun Path . readText ( charset : Charset = Charsets . UTF_8 ) : String

= <EOL> reader ( charset ) . use { it . readText ( ) }

/**
 * Gets the entire content of this file as a String using UTF-8 or the specified [charset].
 *
 * It's not recommended to use this function on huge files.
 * For reading large files or files of unknown size, open a [Reader][Path.reader] and read blocks of text sequentially.
 *
 * @param charset character set to use for reading text, UTF-8 by default.
 * @return the entire content of this file as a String.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> public fun Path . writeText ( text : CharSequence , charset : Charset = Charsets . UTF_8 , vararg options : OpenOption )

{ <EOL> Files . newOutputStream ( this , * options ) . use { out -> <EOL> if ( text is String ) { <EOL> out . writeTextImpl ( text , charset ) <EOL> return@use <EOL> } <EOL> val encoder = charset . newReplaceEncoder ( ) <EOL> val charBuffer = if ( text is CharBuffer ) text . asReadOnlyBuffer ( ) else CharBuffer . wrap ( text ) <EOL> val byteBuffer = byteBufferForEncoding ( chunkSize = minOf ( text . length , DEFAULT_BUFFER_SIZE ) , encoder ) <EOL> while ( charBuffer . hasRemaining ( ) ) { <EOL> encoder . encode ( charBuffer , byteBuffer , true ) . also { check ( ! it . isError ) } <EOL> out . write ( byteBuffer . array ( ) , <NUM_LIT:0> , byteBuffer . position ( ) ) <EOL> byteBuffer . clear ( ) <EOL> } <EOL> } <EOL> }

/**
 * Sets the content of this file as [text] encoded using UTF-8 or the specified [charset].
 *
 * By default, the file will be overwritten if it already exists, but you can control this behavior
 * with [options].
 *
 * @param text text to write into file.
 * @param charset character set to use for writing text, UTF-8 by default.
 * @param options options to determine how the file is opened.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> public fun Path . appendText ( text : CharSequence , charset : Charset = Charsets . UTF_8 )

{ <EOL> writeText ( text , charset , StandardOpenOption . APPEND ) <EOL> }

/**
 * Appends [text] to the content of this file using UTF-8 or the specified [charset].
 *
 * @param text text to append to file.
 * @param charset character set to use for writing text, UTF-8 by default.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . forEachLine ( charset : Charset = Charsets . UTF_8 , action : ( line : String ) -> Unit ) : Unit

{ <EOL> Files . newBufferedReader ( this , charset ) . useLines { it . forEach ( action ) } <EOL> }

/**
 * Reads this file line by line using the specified [charset] and calls [action] for each line.
 * Default charset is UTF-8.
 *
 * You may use this function on huge files.
 *
 * @param charset character set to use for reading text, UTF-8 by default.
 * @param action function to process file lines.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . inputStream ( vararg options : OpenOption ) : InputStream

{ <EOL> return Files . newInputStream ( this , * options ) <EOL> }

/**
 * Constructs a new InputStream of this file and returns it as a result.
 *
 * The [options] parameter determines how the file is opened. If no options are present then it is
 * equivalent to opening the file with the [READ][StandardOpenOption.READ] option.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . outputStream ( vararg options : OpenOption ) : OutputStream

{ <EOL> return Files . newOutputStream ( this , * options ) <EOL> }

/**
 * Constructs a new OutputStream of this file and returns it as a result.
 *
 * The [options] parameter determines how the file is opened. If no options are present then it is
 * equivalent to opening the file with the [CREATE][StandardOpenOption.CREATE],
 * [TRUNCATE_EXISTING][StandardOpenOption.TRUNCATE_EXISTING], and [WRITE][StandardOpenOption.WRITE]
 * options.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . readLines ( charset : Charset = Charsets . UTF_8 ) : List < String >

{ <EOL> return Files . readAllLines ( this , charset ) <EOL> }

/**
 * Reads the file content as a list of lines.
 *
 * It's not recommended to use this function on huge files.
 * For reading lines of a large file or a file of unknown size, use [Path.forEachLine] or [Path.useLines].
 *
 * @param charset character set to use for reading text, UTF-8 by default.
 * @return list of file lines.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun < T > Path . useLines ( charset : Charset = Charsets . UTF_8 , block : ( Sequence < String > ) -> T ) : T

{ <EOL> contract { <EOL> callsInPlace ( block , InvocationKind . EXACTLY_ONCE ) <EOL> } <EOL> return Files . newBufferedReader ( this , charset ) . use { block ( it . lineSequence ( ) ) } <EOL> }

/**
 * Calls the [block] callback giving it a sequence of all the lines in this file and closes the reader once
 * the processing is complete.

 * @param charset character set to use for reading text, UTF-8 by default.
 * @return the value returned by [block].
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . writeLines ( lines : Iterable < CharSequence > , charset : Charset = Charsets . UTF_8 , vararg options : OpenOption ) : Path

{ <EOL> return Files . write ( this , lines , charset , * options ) <EOL> }

/**
 * Write the specified collection of char sequences [lines] to a file terminating each one with the platform's line separator.
 *
 * By default, the file will be overwritten if it already exists, but you can control this behavior
 * with [options].
 *
 * @param charset character set to use for writing text, UTF-8 by default.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . writeLines ( lines : Sequence < CharSequence > , charset : Charset = Charsets . UTF_8 , vararg options : OpenOption ) : Path

{ <EOL> return Files . write ( this , lines . asIterable ( ) , charset , * options ) <EOL> }

/**
 * Write the specified sequence of char sequences [lines] to a file terminating each one with the platform's line separator.
 *
 * By default, the file will be overwritten if it already exists, but you can control this behavior
 * with [options].
 *
 * @param charset character set to use for writing text, UTF-8 by default.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . appendLines ( lines : Iterable < CharSequence > , charset : Charset = Charsets . UTF_8 ) : Path

{ <EOL> return Files . write ( this , lines , charset , StandardOpenOption . APPEND ) <EOL> }

/**
 * Appends the specified collection of char sequences [lines] to a file terminating each one with the platform's line separator.
 *
 * @param charset character set to use for writing text, UTF-8 by default.
 */


@ SinceKotlin ( "<STR_LIT:1.5>" ) <EOL> @ WasExperimental ( ExperimentalPathApi :: class ) <EOL> @ Throws ( IOException :: class ) <EOL> @ kotlin . internal . InlineOnly <EOL> public inline fun Path . appendLines ( lines : Sequence < CharSequence > , charset : Charset = Charsets . UTF_8 ) : Path

{ <EOL> return Files . write ( this , lines . asIterable ( ) , charset , StandardOpenOption . APPEND ) <EOL> }

/**
 * Appends the specified sequence of char sequences [lines] to a file terminating each one with the platform's line separator.
 *
 * @param charset character set to use for writing text, UTF-8 by default.
 */


= foo ( ) . foo ( )

/**
 * this will calculate the return type of `foo` on `CLASS_WITH_SAME_NAME`.
 * Return type of CLASS_WITH_SAME_NAME differs, so we can detect which one was used on Swift side.
 * We are expecting it to be the one that does not have a module - so it will be Swift.Int32.
 */


public abstract fun close ( )

/**
 * Initiate the closing sequence of the coroutine dispatcher.
 * After a successful call to [close], no new tasks will be accepted to be [dispatched][dispatch].
 * The previously-submitted tasks will still be run, but [close] is not guaranteed to wait for them to finish.
 *
 * Invocations of `close` are idempotent and thread-safe.
 */


override fun isStrictEnum ( enumDef : EnumDef ) : Boolean

= with ( enumDef ) { <EOL> if ( this . isAnonymous ) { <EOL> return false <EOL> } <EOL> val name = this . kotlinName <EOL> if ( name in configuration . strictEnums ) { <EOL> return true <EOL> } <EOL> if ( name in configuration . nonStrictEnums ) { <EOL> return false <EOL> } <EOL> return ! this . constants . any { it . isExplicitlyDefined } <EOL> }

/**
 * Indicates whether this enum should be represented as Kotlin enum.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > maxOf ( a : T , b : T ) : T

{ <EOL> return if ( a >= b ) a else b <EOL> }

/**
 * Returns the greater of two values.
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Byte , b : Byte ) : Byte

{ <EOL> return Math . max ( a . toInt ( ) , b . toInt ( ) ) . toByte ( ) <EOL> }

/**
 * Returns the greater of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Short , b : Short ) : Short

{ <EOL> return Math . max ( a . toInt ( ) , b . toInt ( ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Int , b : Int ) : Int

{ <EOL> return Math . max ( a , b ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Long , b : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Float , b : Float ) : Float

/**
 * Returns the greater of two values.
 *
 * If either value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Double , b : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > maxOf ( a : T , b : T , c : T ) : T

{ <EOL> return maxOf ( a , maxOf ( b , c ) ) <EOL> }

/**
 * Returns the greater of three values.
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Byte , b : Byte , c : Byte ) : Byte

{ <EOL> return Math . max ( a . toInt ( ) , Math . max ( b . toInt ( ) , c . toInt ( ) ) ) . toByte ( ) <EOL> }

/**
 * Returns the greater of three values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Short , b : Short , c : Short ) : Short

{ <EOL> return Math . max ( a . toInt ( ) , Math . max ( b . toInt ( ) , c . toInt ( ) ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Int , b : Int , c : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Long , b : Long , c : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Float , b : Float , c : Float ) : Float

/**
 * Returns the greater of three values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun maxOf ( a : Double , b : Double , c : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun < T : Comparable < T > > maxOf ( a : T , vararg other : T ) : T

{ <EOL> var max = a <EOL> for ( e in other ) max = maxOf ( max , e ) <EOL> return max <EOL> }

/**
 * Returns the greater of the given values.
 *
 * If there are multiple equal maximal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Byte , vararg other : Byte ) : Byte

/**
 * Returns the greater of the given values.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Short , vararg other : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Int , vararg other : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Long , vararg other : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Float , vararg other : Float ) : Float

/**
 * Returns the greater of the given values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun maxOf ( a : Double , vararg other : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > minOf ( a : T , b : T ) : T

{ <EOL> return if ( a <= b ) a else b <EOL> }

/**
 * Returns the smaller of two values.
 *
 * If values are equal, returns the first one.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Byte , b : Byte ) : Byte

{ <EOL> return Math . min ( a . toInt ( ) , b . toInt ( ) ) . toByte ( ) <EOL> }

/**
 * Returns the smaller of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Short , b : Short ) : Short

{ <EOL> return Math . min ( a . toInt ( ) , b . toInt ( ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Int , b : Int ) : Int

{ <EOL> return Math . min ( a , b ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Long , b : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Float , b : Float ) : Float

/**
 * Returns the smaller of two values.
 *
 * If either value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Double , b : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T : Comparable < T > > minOf ( a : T , b : T , c : T ) : T

{ <EOL> return minOf ( a , minOf ( b , c ) ) <EOL> }

/**
 * Returns the smaller of three values.
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Byte , b : Byte , c : Byte ) : Byte

{ <EOL> return Math . min ( a . toInt ( ) , Math . min ( b . toInt ( ) , c . toInt ( ) ) ) . toByte ( ) <EOL> }

/**
 * Returns the smaller of three values.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Short , b : Short , c : Short ) : Short

{ <EOL> return Math . min ( a . toInt ( ) , Math . min ( b . toInt ( ) , c . toInt ( ) ) ) . toShort ( ) <EOL> }


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Int , b : Int , c : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Long , b : Long , c : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Float , b : Float , c : Float ) : Float

/**
 * Returns the smaller of three values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun minOf ( a : Double , b : Double , c : Double ) : Double


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun < T : Comparable < T > > minOf ( a : T , vararg other : T ) : T

{ <EOL> var min = a <EOL> for ( e in other ) min = minOf ( min , e ) <EOL> return min <EOL> }

/**
 * Returns the smaller of the given values.
 *
 * If there are multiple equal minimal values, returns the first of them.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Byte , vararg other : Byte ) : Byte

/**
 * Returns the smaller of the given values.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Short , vararg other : Short ) : Short


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Int , vararg other : Int ) : Int


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Long , vararg other : Long ) : Long


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Float , vararg other : Float ) : Float

/**
 * Returns the smaller of the given values.
 *
 * If any value is `NaN`, returns `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.4>" ) <EOL> public actual fun minOf ( a : Double , vararg other : Double ) : Double


= MapImplementation . hashCode ( this )

/**
 * We provide [equals], so as a matter of style, we should also provide [hashCode].
 *
 * Should be `super.hashCode()`, but https://youtrack.jetbrains.com/issue/KT-45673
 */


internal fun < Data , Context : PhaseContext > getDefaultIrActions ( ) : Set < Action < Data , Context > >

= setOfNotNull ( getIrDumper ( ) , getIrValidator < Context , Data > ( ) )


= Seq . empty < T > ( ) as Seq < T >

/** Returns a new empty immutable Seq. */


fun < T > seqOf ( vararg elements : T ) : Seq < T >

= <EOL> if ( elements . isEmpty ( ) ) <EOL> emptySeq ( ) <EOL> else <EOL> Seq . newBuilder < T > ( ) . apply { <EOL> for ( it in elements ) <EOL> `$plus$eq` ( it ) <EOL> } . result ( ) as Seq < T >

/** Returns a new immutable Seq with the given elements. */


fun < T > emptyMutableSeq ( ) : MutableSeq < T >

= MutableSeq . empty < T > ( ) as MutableSeq < T >

/** Returns a new mutable Seq with the given elements. */


fun < T > mutableSeqOf ( vararg elements : T ) : MutableSeq < T >

= <EOL> if ( elements . isEmpty ( ) ) <EOL> emptyMutableSeq ( ) <EOL> else <EOL> MutableSeq . newBuilder < T > ( ) . apply { <EOL> for ( it in elements ) <EOL> `$plus$eq` ( it ) <EOL> } . result ( ) as MutableSeq < T >


internal fun < CT > construct ( constructorType : dynamic , resultType : dynamic , vararg args : Any ? ) : Any

{ <EOL> return js ( "<STR_LIT>" ) . construct ( constructorType , args , resultType ) <EOL> }

/**
 * @param CT is return type of calling constructor (uses in DCE)
 */


fun isReparseableBlock ( blockText : CharSequence ) : Boolean

{ <EOL> fun advanceWhitespacesCheckIsEndOrArrow ( lexer : KotlinLexer ) : Boolean { <EOL> lexer . advance ( ) <EOL> while ( lexer . tokenType != null && lexer . tokenType != KtTokens . EOF ) { <EOL> if ( lexer . tokenType == KtTokens . ARROW ) return true <EOL> if ( lexer . tokenType != KtTokens . WHITE_SPACE ) return false <EOL> lexer . advance ( ) <EOL> } <EOL> return true <EOL> } <EOL> val lexer = KotlinLexer ( ) <EOL> lexer . start ( blockText ) <EOL> if ( lexer . tokenType != KtTokens . LBRACE ) return false <EOL> if ( advanceWhitespacesCheckIsEndOrArrow ( lexer ) ) return false <EOL> if ( lexer . tokenType != KtTokens . COLON && lexer . tokenType != KtTokens . IDENTIFIER && lexer . tokenType != KtTokens . LPAR ) return true <EOL> val searchForRPAR = lexer . tokenType == KtTokens . LPAR <EOL> if ( advanceWhitespacesCheckIsEndOrArrow ( lexer ) ) return false <EOL> val preferParamsToExpressions = lexer . tokenType == KtTokens . COMMA || lexer . tokenType == KtTokens . COLON <EOL> while ( true ) { <EOL> if ( lexer . tokenType == KtTokens . LBRACE ) return true <EOL> if ( lexer . tokenType == KtTokens . RBRACE ) return ! preferParamsToExpressions <EOL> if ( searchForRPAR && lexer . tokenType == KtTokens . RPAR ) { <EOL> return ! advanceWhitespacesCheckIsEndOrArrow ( lexer ) <EOL> } <EOL> if ( advanceWhitespacesCheckIsEndOrArrow ( lexer ) ) return false <EOL> } <EOL> }

/**
 * Check if this text is block but not a lambda, please refer to parsing rules!
 @see [org.jetbrains.kotlin.parsing.KotlinExpressionParsing.parseFunctionLiteral]
 */


public fun onModification ( module : KtModule )

/**
 * [onModification] is invoked in a write action before or after a context change for code fragments depending on the [module].
 *
 * All code fragments depending on [module], both directly or transitively, should be considered modified when this event is received.
 *
 * @see KotlinTopics
 */


inline fun < KEY , VALUE , reified R > KeyValueGroupedDataset < KEY , VALUE > . mapValues ( noinline func : ( VALUE ) -> R ) : KeyValueGroupedDataset < KEY , R >

= <EOL> mapValues ( MapFunction ( func ) , encoder < R > ( ) )

/**
 * Returns a new [KeyValueGroupedDataset] where the given function [func] has been applied
 * to the data. The grouping key is unchanged by this.
 *
 * ```kotlin
 * // Create values grouped by key from a Dataset<Arity2<K, V>>
 * ds.groupByKey { it._1 }.mapValues { it._2 }
 * ```
 */


inline fun < KEY , VALUE , reified R > KeyValueGroupedDataset < KEY , VALUE > . mapGroups ( noinline func : ( KEY , Iterator < VALUE > ) -> R ) : Dataset < R >

= <EOL> mapGroups ( MapGroupsFunction ( func ) , encoder < R > ( ) )

/**
 * (Kotlin-specific)
 * Applies the given function to each group of data. For each unique group, the function will
 * be passed the group key and an iterator that contains all the elements in the group. The
 * function can return an element of arbitrary type which will be returned as a new [Dataset].
 *
 * This function does not support partial aggregation, and as a result requires shuffling all
 * the data in the [Dataset]. If an application intends to perform an aggregation over each
 * key, it is best to use the reduce function or an
 * [org.apache.spark.sql.expressions.Aggregator].
 *
 * Internally, the implementation will spill to disk if any given group is too large to fit into
 * memory. However, users must take care to avoid materializing the whole iterator for a group
 * (for example, by calling [toList]) unless they are sure that this is possible given the memory
 * constraints of their cluster.
 */


inline fun < reified KEY , reified VALUE > KeyValueGroupedDataset < KEY , VALUE > . reduceGroupsK ( noinline func : ( VALUE , VALUE ) -> VALUE ) : Dataset < Tuple2 < KEY , VALUE > >

= <EOL> reduceGroups ( ReduceFunction ( func ) )

/**
 * (Kotlin-specific)
 * Reduces the elements of each group of data using the specified binary function.
 * The given function must be commutative and associative or the result may be non-deterministic.
 *
 * Note that you need to use [reduceGroupsK] always instead of the Java- or Scala-specific
 * [KeyValueGroupedDataset.reduceGroups] to make the compiler work.
 */


inline fun < K , V , reified U > KeyValueGroupedDataset < K , V > . flatMapGroups ( noinline func : ( key : K , values : Iterator < V > ) -> Iterator < U > , ) : Dataset < U >

= flatMapGroups ( FlatMapGroupsFunction ( func ) , encoder < U > ( ) , )

/**
 * (Kotlin-specific)
 * Applies the given function to each group of data. For each unique group, the function will
 * be passed the group key and an iterator that contains all the elements in the group. The
 * function can return an iterator containing elements of an arbitrary type which will be returned
 * as a new [Dataset].
 *
 * This function does not support partial aggregation, and as a result requires shuffling all
 * the data in the [Dataset]. If an application intends to perform an aggregation over each
 * key, it is best to use the reduce function or an
 * [org.apache.spark.sql.expressions.Aggregator].
 *
 * Internally, the implementation will spill to disk if any given group is too large to fit into
 * memory. However, users must take care to avoid materializing the whole iterator for a group
 * (for example, by calling [toList]) unless they are sure that this is possible given the memory
 * constraints of their cluster.
 */


inline fun < K , V , reified S , reified U > KeyValueGroupedDataset < K , V > . mapGroupsWithState ( noinline func : ( key : K , values : Iterator < V > , state : GroupState < S > ) -> U , ) : Dataset < U >

= mapGroupsWithState ( MapGroupsWithStateFunction ( func ) , encoder < S > ( ) , encoder < U > ( ) , )

/**
 * (Kotlin-specific)
 * Applies the given function to each group of data, while maintaining a user-defined per-group
 * state. The result Dataset will represent the objects returned by the function.
 * For a static batch Dataset, the function will be invoked once per group. For a streaming
 * Dataset, the function will be invoked for each group repeatedly in every trigger, and
 * updates to each group's state will be saved across invocations.
 * See [org.apache.spark.sql.streaming.GroupState] for more details.
 *
 * @param S The type of the user-defined state. Must be encodable to Spark SQL types.
 * @param U The type of the output objects. Must be encodable to Spark SQL types.
 * @param func Function to be called on every group.
 *
 * See [Encoder] for more details on what types are encodable to Spark SQL.
 */


inline fun < K , V , reified S , reified U > KeyValueGroupedDataset < K , V > . mapGroupsWithState ( timeoutConf : GroupStateTimeout , noinline func : ( key : K , values : Iterator < V > , state : GroupState < S > ) -> U , ) : Dataset < U >

= mapGroupsWithState ( MapGroupsWithStateFunction ( func ) , encoder < S > ( ) , encoder < U > ( ) , timeoutConf , )

/**
 * (Kotlin-specific)
 * Applies the given function to each group of data, while maintaining a user-defined per-group
 * state. The result Dataset will represent the objects returned by the function.
 * For a static batch Dataset, the function will be invoked once per group. For a streaming
 * Dataset, the function will be invoked for each group repeatedly in every trigger, and
 * updates to each group's state will be saved across invocations.
 * See [org.apache.spark.sql.streaming.GroupState] for more details.
 *
 * @param S The type of the user-defined state. Must be encodable to Spark SQL types.
 * @param U The type of the output objects. Must be encodable to Spark SQL types.
 * @param func Function to be called on every group.
 * @param timeoutConf Timeout configuration for groups that do not receive data for a while.
 *
 * See [Encoder] for more details on what types are encodable to Spark SQL.
 */


inline fun < K , V , reified S , reified U > KeyValueGroupedDataset < K , V > . flatMapGroupsWithState ( outputMode : OutputMode , timeoutConf : GroupStateTimeout , noinline func : ( key : K , values : Iterator < V > , state : GroupState < S > ) -> Iterator < U > , ) : Dataset < U >

= flatMapGroupsWithState ( FlatMapGroupsWithStateFunction ( func ) , outputMode , encoder < S > ( ) , encoder < U > ( ) , timeoutConf , )

/**
 * (Kotlin-specific)
 * Applies the given function to each group of data, while maintaining a user-defined per-group
 * state. The result Dataset will represent the objects returned by the function.
 * For a static batch Dataset, the function will be invoked once per group. For a streaming
 * Dataset, the function will be invoked for each group repeatedly in every trigger, and
 * updates to each group's state will be saved across invocations.
 * See [GroupState] for more details.
 *
 * @param S The type of the user-defined state. Must be encodable to Spark SQL types.
 * @param U The type of the output objects. Must be encodable to Spark SQL types.
 * @param func Function to be called on every group.
 * @param outputMode The output mode of the function.
 * @param timeoutConf Timeout configuration for groups that do not receive data for a while.
 *
 * See [Encoder] for more details on what types are encodable to Spark SQL.
 */


inline fun < K , V , U , reified R > KeyValueGroupedDataset < K , V > . cogroup ( other : KeyValueGroupedDataset < K , U > , noinline func : ( key : K , left : Iterator < V > , right : Iterator < U > ) -> Iterator < R > , ) : Dataset < R >

= cogroup ( other , CoGroupFunction ( func ) , encoder < R > ( ) , )

/**
 * (Kotlin-specific)
 * Applies the given function to each cogrouped data. For each unique group, the function will
 * be passed the grouping key and 2 iterators containing all elements in the group from
 * [Dataset] [this] and [other]. The function can return an iterator containing elements of an
 * arbitrary type which will be returned as a new [Dataset].
 */


internal fun State . checkNullability ( irType : IrType ? , environment : IrInterpreterEnvironment , exceptionToThrow : ( ) -> Throwable = { NullPointerException ( ) } ) : State ?

{ <EOL> if ( irType !is IrSimpleType ) return this <EOL> if ( this . isNull ( ) && ! irType . isNullable ( ) ) { <EOL> exceptionToThrow ( ) . handleUserException ( environment ) <EOL> return null <EOL> } <EOL> return this <EOL> }

/**
 * This method used to check if for not null parameter there was passed null argument.
 */


public fun < T : Number > pow ( mat : MultiArray < T , D2 > , n : Int ) : NDArray < T , D2 >

/**
 * Raise a square matrix to power [n].
 */


internal fun Project . addIntransitiveMetadataDependencyIfPossible ( sourceSet : DefaultKotlinSourceSet , dependency : FileCollection )

{ <EOL> val dependencyConfigurationName = if ( project . isIntransitiveMetadataConfigurationEnabled ) { <EOL> sourceSet . intransitiveMetadataConfigurationName <EOL> } else { <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> sourceSet . implementationMetadataConfigurationName <EOL> } <EOL> project . dependencies . add ( dependencyConfigurationName , dependency ) <EOL> }

/**
 * Dependencies here are using a special configuration called 'intransitiveMetadataConfiguration'.
 * This special configuration can tell the IDE that these dependencies shall *not* be transitively visible
 * to dependsOn edges.
 * This is necessary for the way the commonizer handles its "expect refinement" approach.
 * In this mode, every source set will receive exactly one commonized library to analyze its source code with.
 */


private fun setWorkbookTempDirectory ( )

{ <EOL> val tempDir = try { <EOL> Files . createTempDirectory ( readExcelTempFolderPrefix ) <EOL> . toFile ( ) <EOL> . also { it . deleteOnExit ( ) } <EOL> } catch ( e : Exception ) { <EOL> return <EOL> } <EOL> TempFile . setTempFileCreationStrategy ( DefaultTempFileCreationStrategy ( tempDir ) ) <EOL> }

/**
 * To prevent [Issue #402](https://github.com/Kotlin/dataframe/issues/402):
 *
 * Creates new temp directory instead of the default `/tmp/poifiles` which would
 * cause permission issues for multiple users.
 */