internal inline fun < reified T : KotlinTarget > KotlinTargetSideEffect ( crossinline effect : ( T ) -> Unit )

= KotlinTargetSideEffect { target -> <EOL> if ( target is T ) effect ( target ) <EOL> }


public fun KtSymbol . getDeprecationStatus ( annotationUseSiteTarget : AnnotationUseSiteTarget ? ) : DeprecationInfo ?

= <EOL> withValidityAssertion { analysisSession . symbolInfoProvider . getDeprecation ( this , annotationUseSiteTarget ) }

/**
 * Gets the deprecation status of the given symbol. Returns null if the symbol is not deprecated.
 */


public fun valueParameter ( name : Name , type : ConeKotlinType , isCrossinline : Boolean = false , isNoinline : Boolean = false , isVararg : Boolean = false , hasDefaultValue : Boolean = false , key : GeneratedDeclarationKey = this @ FunctionBuildingContext . key )

{ <EOL> valueParameter ( name , { type } , isCrossinline , isNoinline , isVararg , hasDefaultValue , key ) <EOL> }

/**
 * Adds value parameter with [type] type to constructed function
 *
 * If you set [hasDefaultValue] to true then you need to generate actual default value
 * in [IrGenerationExtension]
 */


public fun valueParameter ( name : Name , typeProvider : ( List < FirTypeParameterRef > ) -> ConeKotlinType , isCrossinline : Boolean = false , isNoinline : Boolean = false , isVararg : Boolean = false , hasDefaultValue : Boolean = false , key : GeneratedDeclarationKey = this @ FunctionBuildingContext . key )

{ <EOL> valueParameters += ValueParameterData ( name , typeProvider , isCrossinline , isNoinline , isVararg , hasDefaultValue , key ) <EOL> }

/**
 * Adds value parameter with type provided by [typeProvider] to constructed function
 * Use this overload when parameter type uses type parameters of constructed declaration
 *
 * If you set [hasDefaultValue] to true then you need to generate actual default value
 * in [IrGenerationExtension]
 */


@ SuppressLint ( "<STR_LIT>" ) <EOL> override fun onCreate ( savedInstanceState : Bundle ? )

{ <EOL> super . onCreate ( savedInstanceState ) <EOL> val textView = TextView ( this ) <EOL> textView . text = "<STR_LIT>" <EOL> setContentView ( textView ) <EOL> }


public abstract fun allocate ( size : Int ) : Pointer

/**
 * Allocates a block of uninitialized linear memory of the given [size] in bytes.
 *
 * @return an address of allocated memory. It is guaranteed to be a multiple of 8.
 */


@ UnsafeWasmMemoryApi <EOL> public inline fun < T > withScopedMemoryAllocator ( block : ( allocator : MemoryAllocator ) -> T ) : T

{ <EOL> contract { callsInPlace ( block , InvocationKind . EXACTLY_ONCE ) } <EOL> val allocator = createAllocatorInTheNewScope ( ) <EOL> val result = try { <EOL> block ( allocator ) <EOL> } finally { <EOL> allocator . destroy ( ) <EOL> currentAllocator = allocator . parent <EOL> } <EOL> return result <EOL> }

/**
 * Runs the [block] of code, providing it a temporary [MemoryAllocator] as an argument, and returns the result of this block.
 *
 * Frees all memory allocated with the provided allocator after running the [block].
 *
 * This function is intened to facilitate the exchange of values with outside world through linear memory.
 * For example:
 *
 * ```
 * val buffer_size = ...
 * withScopedMemoryAllocator { allocator ->
 * val buffer_address = allocator.allocate(buffer_size)
 * importedWasmFunctionThatWritesToBuffer(buffer_address, buffer_size)
 * return readDataFromBufferIntoManagedKotlinMemory(buffer_address, buffer_size)
 * }
 * ```
 *
 * WARNING! Addresses allocated inside the [block] function become invalid after exiting the function.
 *
 * WARNING! A nested call to [withScopedMemoryAllocator] will temporarily disable the allocator from the outer scope
 * for the duration of the call. Calling [MemoryAllocator.allocate] on a disabled allocator
 * will throw [IllegalStateException].
 *
 * WARNING! Accessing the allocator outside of the [block] scope will throw [IllegalStateException].
 */


@ WasmOp ( WasmOp . MEMORY_SIZE ) <EOL> internal fun wasmMemorySize ( ) : Int

= <EOL> implementedAsIntrinsic

/**
 * Current linear memory size in pages
 */


@ Suppress ( "<STR_LIT:UNUSED_PARAMETER>" ) <EOL> @ WasmOp ( WasmOp . MEMORY_GROW ) <EOL> internal fun wasmMemoryGrow ( delta : Int ) : Int

= <EOL> implementedAsIntrinsic

/**
 * Grow memory by a given delta (in pages).
 * Return the previous size, or -1 if enough memory cannot be allocated.
 */


{ <EOL> val resource = Operation :: class . java . getResource ( "<STR_LIT>" ) ! ! <EOL> val imageDirectory = Paths . get ( resource . toURI ( ) ) . toFile ( ) <EOL> val images = OnHeapDataset . create ( imageDirectory , EmptyLabels ( ) ) . x <EOL> val datasetMean = mean ( * images , channels = <NUM_LIT:3> ) <EOL> val datasetStd = std ( * images , channels = <NUM_LIT:3> ) <EOL> println ( "<STR_LIT>" ) <EOL> val imageResource = Operation :: class . java . getResource ( "<STR_LIT>" ) <EOL> val image = File ( imageResource ! ! . toURI ( ) ) <EOL> val imageFloats = ImageConverter . toRawFloatArray ( image ) <EOL> println ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> val preprocessing = pipeline < BufferedImage > ( ) <EOL> . toFloatArray { } <EOL> . normalize { <EOL> mean = datasetMean <EOL> std = datasetStd <EOL> } <EOL> val ( processedImageFloats , _ ) = preprocessing . fileLoader ( ) . load ( image ) <EOL> println ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> }

/**
 * This example demonstrates [normalize] tensor preprocessor.
 * It shows how to compute mean and std values for the dataset and how to use these values for normalization.
 */


fun getTypeBounds ( typeVariable : TypeVariable ) : TypeBounds

/**
 * Returns the resulting type constraints of solving the constraint system for specific type parameter descriptor.
 * Throws IllegalArgumentException if the type parameter descriptor is not known to the system.
 */


fun registerTypeVariables ( call : CallHandle , typeParameters : Collection < TypeParameterDescriptor > , external : Boolean = false ) : TypeSubstitutor

/**
 * Registers variables in a constraint system. Returns a substitutor which maps type parameter descriptors passed as parameters
 * to the corresponding types of variables of the system. Use that substitutor to provide constraints to the system
 */


fun addSubtypeConstraint ( constrainingType : KotlinType ? , subjectType : KotlinType ? , constraintPosition : ConstraintPosition )

/**
 * Adds a constraint that the constraining type is a subtype of the subject type.
 * Asserts that only subject type may contain registered type variables.
 *
 * For example, for `fun <T> id(t: T) {}` to infer `T` in invocation `id(1)`
 * the constraint "Int is a subtype of T" should be generated where T is a subject type, and Int is a constraining type.
 */


fun add ( other : Builder )

/**
 * Add all variables and constraints from the other system to this one. The other system may not have any common variables
 * with this one, or even variables registered for calls, for which this system also has some registered variables
 */


public inline fun LayerCollectorContext . step ( block : StepContext . ( ) -> Unit )

{ <EOL> addLayer ( StepContext ( this ) . apply ( block ) ) <EOL> }

/**
 * Adds a new `step` layer to the plot.
 *
 * The `step` layer is used to create step plots,
 * which are useful for representing data that changes at discrete intervals,
 * often seen in time series or ordinal data.
 *
 * 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.
 *
 * ## Step Aesthetics
 * * **`x`** - The X-coordinate specifying the points at which the steps change.
 * * **`y`** - The Y-coordinate specifying the height of each step.
 * * **`color`** - The color of the steps.
 * * **`lineType`** - The type of the step line, such as dashed or dotted.
 * * **`width`** - The width of the step line.
 * * **`alpha`** - The transparency of the step line.
 *
 * ## Example Usage
 *
 * ```kotlin
 * plot {
 * step {
 * // Positional mapping
 * x(listOf(1, 2, 3, 4, 5))
 * y(listOf(3, 5, 2, 8, 3))
 *
 * // Non-positional mapping
 * color = Color.RED
 *
 * // Non-positional settings
 * width = 2.5
 * alpha = 0.7
 * lineType = LineType.LONGDASH
 * }
 * }
 * ```
 */


internal fun Project . setupCInteropPropagatedDependencies ( )

{ <EOL> val kotlin = this . multiplatformExtensionOrNull ? : return <EOL> kotlin . forAllSharedNativeCompilations { compilation -> <EOL> compilation . compileDependencyFiles += getPropagatedCInteropDependenciesOrEmpty ( compilation ) <EOL> } <EOL> kotlin . forAllDefaultKotlinSourceSets { sourceSet -> <EOL> addIntransitiveMetadataDependencyIfPossible ( sourceSet , getPropagatedCInteropDependenciesOrEmpty ( sourceSet ) ) <EOL> } <EOL> }

/**
 * Will propagate "original"/"platform" cinterops to intermediate source sets
 * and 'shared native' compilations if necessary.
 *
 * cinterops will be forwarded when a source set/ compilation has just a single platform
 * dependee
 *
 * e.g.
 *
 * ```
 * kotlin {
 * sourceSets {
 * val nativeMain by sourceSets.creating
 * val linuxX64Main by sourceSets.getting
 * linuxX64Main.dependsOn(nativeMain)
 * }
 * }
 * ```
 *
 * In this example 'nativeMain' has only a single native
 * target and a single native source set depending on it.
 * All cinterops defined on linuxX64's main compilation shall be propagated
 * to the 'nativeMain' source set (and its 'shared native' compilation) if it exists.
 */


public fun Path . copyToIgnoringExistingDirectory ( target : Path , followLinks : Boolean ) : CopyActionResult

/**
 * Copies the entry located by this path to the specified [target] path,
 * except if both this and [target] entries are directories,
 * in which case the method completes without copying the entry.
 *
 * The entry is copied using `this.copyTo(target, *followLinksOption)`. See [kotlin.io.path.copyTo].
 *
 * @param target the path to copy this entry to.
 * @param followLinks `false` to copy the entry itself even if it's a symbolic link.
 * `true` to copy its target if this entry is a symbolic link.
 * If this entry is not a symbolic link, the value of this parameter doesn't make any difference.
 * @return [CopyActionResult.CONTINUE]
 */


@ SinceKotlin ( "<STR_LIT:1.1>" ) <EOL> public actual fun < T , K > Grouping < T , K > . eachCount ( ) : Map < K , Int >

= <EOL> foldTo ( destination = mutableMapOf ( ) , initialValueSelector = { _ , _ -> kotlin . jvm . internal . Ref . IntRef ( ) } , operation = { _ , acc , _ -> acc . apply { element += <NUM_LIT:1> } } ) <EOL> . mapValuesInPlace { it . value . element }

/**
 * Groups elements from the [Grouping] source by key and counts elements in each group.
 *
 * @return a [Map] associating the key of each group with the count of elements in the group.
 *
 * @sample samples.collections.Grouping.groupingByEachCount
 */


private fun IrBuilderWithScope . kClassArrayToJClassArray ( kClassArray : IrExpression ) : IrExpression

{ <EOL> val javaLangClassType = javaLangClassSymbol . starProjectedType <EOL> val jlcArray = symbols . array . typeWith ( javaLangClassType ) <EOL> val arrayClass = symbols . array . owner <EOL> val arrayOfNulls = symbols . arrayOfNulls <EOL> val arraySizeSymbol = arrayClass . findDeclaration < IrProperty > { it . name . asString ( ) == "<STR_LIT>" } ! ! . getter ! ! <EOL> val block = irBlock { <EOL> val sourceArray = createTmpVariable ( kClassArray , "<STR_LIT:src>" , isMutable = false ) <EOL> val index = createTmpVariable ( irInt ( <NUM_LIT:0> ) , "<STR_LIT:i>" , isMutable = true ) <EOL> val size = createTmpVariable ( irCall ( arraySizeSymbol ) . apply { dispatchReceiver = irGet ( sourceArray ) } , "<STR_LIT>" , isMutable = false ) <EOL> val result = createTmpVariable ( irCall ( arrayOfNulls , jlcArray ) . apply { <EOL> listOf ( javaLangClassType ) <EOL> putValueArgument ( <NUM_LIT:0> , irGet ( size ) ) <EOL> } ) <EOL> val comparison = primitiveOp2 ( startOffset , endOffset , context . irBuiltIns . lessFunByOperandType [ context . irBuiltIns . intType . classifierOrFail ] ! ! , context . irBuiltIns . booleanType , IrStatementOrigin . LT , irGet ( index ) , irGet ( size ) ) <EOL> val setArraySymbol = arrayClass . functions . single { it . name == OperatorNameConventions . SET } <EOL> val getArraySymbol = arrayClass . functions . single { it . name == OperatorNameConventions . GET } <EOL> val inc = context . irBuiltIns . intType . getClass ( ) ! ! . functions . single { it . name == OperatorNameConventions . INC } <EOL> + irWhile ( ) . also { loop -> <EOL> loop . condition = comparison <EOL> loop . body = irBlock { <EOL> val tempIndex = createTmpVariable ( irGet ( index ) ) <EOL> val getArray = irCall ( getArraySymbol ) . apply { <EOL> dispatchReceiver = irGet ( sourceArray ) <EOL> putValueArgument ( <NUM_LIT:0> , irGet ( tempIndex ) ) <EOL> } <EOL> + irCall ( setArraySymbol ) . apply { <EOL> dispatchReceiver = irGet ( result ) <EOL> putValueArgument ( <NUM_LIT:0> , irGet ( tempIndex ) ) <EOL> putValueArgument ( <NUM_LIT:1> , kClassToJClass ( getArray ) ) <EOL> } <EOL> + irSet ( index . symbol , irCallOp ( inc . symbol , index . type , irGet ( index ) ) ) <EOL> } <EOL> } <EOL> + irGet ( result ) <EOL> } <EOL> return block <EOL> }

/**
 * Copies array by one element, roughly as following:
 * val size = kClassArray.size
 * val result = arrayOfNulls<java.lang.Class>(size)
 * var i = 0
 * while(i < size) {
 * result[i] = kClassArray[i].java
 * i++
 * }
 * Partially taken from ArrayConstructorLowering.kt
 */


fun moveBlockAfterEntry ( block : LLVMBasicBlockRef )

{ <EOL> LLVMMoveBasicBlockAfter ( block , this . entryBb ) <EOL> }

/**
 * This function shouldn't be used normally.
 * It is used to move block with strange debug info in the middle of function, to avoid last debug info being too strange,
 * because it will break heuristics in CoreSymbolication
 */


fun getEnumEntry ( enumEntry : IrEnumEntry , exceptionHandler : ExceptionHandler ) : LLVMValueRef

{ <EOL> val enumClass = enumEntry . parentAsClass <EOL> val getterId = context . enumsSupport . enumEntriesMap ( enumClass ) [ enumEntry . name ] ! ! . getterId <EOL> return call ( context . enumsSupport . getValueGetter ( enumClass ) . llvmFunction , listOf ( llvm . int32 ( getterId ) ) , Lifetime . GLOBAL , exceptionHandler ) <EOL> }

/**
 * Note: the same code is generated as IR in [org.jetbrains.kotlin.backend.konan.lower.EnumUsageLowering].
 */


= currentPositionHolder . isAfterTerminator

/**
 * Returns `true` iff the current code generation position is located after terminator instruction.
 */


override fun visit ( x : JsObjectLiteral , ctx : JsContext < JsNode > ) : Boolean

= false

/**
 * Prevents replacing returns in object literal
 */


override fun visit ( x : JsFunction , ctx : JsContext < JsNode > ) : Boolean

= false

/**
 * Prevents replacing returns in inner function
 */


public fun ConvertSchemaDsl < * > . convertDataRowsWithOpenApi ( )

{ <EOL> convert < DataRow < * > > ( ) . with < _ , Any ? > { it } <EOL> convertIf ( { fromType , toSchema -> <EOL> val ( fromIsRecursiveListOfDataFrame , fromDepth ) = fromType . isRecursiveListOfDataFrame ( ) <EOL> val ( toIsRecursiveListOfDataFrame , toDepth ) = toSchema . type . isRecursiveListOfDataFrame ( ) <EOL> fromIsRecursiveListOfDataFrame && toIsRecursiveListOfDataFrame && fromDepth == toDepth <EOL> } ) { <EOL> try { <EOL> it . convertRecursiveListOfDataFrame ( toSchema . type ) { <EOL> convertDataRowsWithOpenApi ( ) <EOL> } <EOL> } catch ( _ : Exception ) { <EOL> it <EOL> } <EOL> } <EOL> }

/**
 * Function to be used in [ConvertSchemaDsl] ([DataFrame.convertTo]) to help convert a DataFrame to adhere to an
 * OpenApi schema. Is used in generated OpenAPI code.
 */


private fun KType . isRecursiveListOfDataFrame ( depth : Int = <NUM_LIT:0> ) : Pair < Boolean , Int >

= when ( jvmErasure ) { <EOL> typeOf < List < * > > ( ) . jvmErasure -> arguments [ <NUM_LIT:0> ] . type ? . isRecursiveListOfDataFrame ( depth + <NUM_LIT:1> ) ? : ( false to depth ) <EOL> typeOf < DataFrame < * > > ( ) . jvmErasure -> true to depth <EOL> typeOf < DataFrame < * > ? > ( ) . jvmErasure -> true to depth <EOL> else -> false to depth <EOL> }

/**
 * @receiver [KType] to check if it is a recursive list of [DataFrame]s
 * @return [Pair] of result and the recursive depth.
 * `true` if Receiver is a recursive list of [DataFrame]s, like [List]<[List]<[DataFrame]<*>>>
 */


private fun Any ? . convertRecursiveListOfDataFrame ( type : KType , convertTo : ConvertSchemaDsl < * > . ( ) -> Unit = { } , ) : Any ?

= when ( this ) { <EOL> is List < * > -> map { it ? . convertRecursiveListOfDataFrame ( type . arguments [ <NUM_LIT:0> ] . type ! ! , convertTo ) } <EOL> is DataFrame < * > -> convertTo ( schemaType = type . arguments [ <NUM_LIT:0> ] . type ! ! , body = convertTo ) <EOL> null -> null <EOL> else -> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> }

/**
 * @receiver Recursive [List] of [DataFrame]s, like [List]<[List]<[DataFrame]<*>>>, for which to convert the [DataFrame]s.
 * @param type Type to which to convert the [DataFrame]s.
 * @param convertTo Optional [ConvertSchemaDsl] to use for the conversion.
 * @return Receiver with converted [DataFrame]s.
 */


fun efficientNetB7LightAPIPrediction ( )

{ <EOL> val modelHub = <EOL> ONNXModelHub ( cacheDirectory = File ( "<STR_LIT>" ) ) <EOL> val model = ONNXModels . CV . EfficientNetB7 . pretrainedModel ( modelHub ) <EOL> model . printSummary ( ) <EOL> model . use { <EOL> for ( i in <NUM_LIT:1> .. <NUM_LIT:8> ) { <EOL> val imageFile = getFileFromResource ( "<STR_LIT>" ) <EOL> val recognizedObject = it . predictObject ( imageFile = imageFile ) <EOL> println ( recognizedObject ) <EOL> val top5 = it . predictTopKObjects ( imageFile = imageFile , topK = <NUM_LIT:5> ) <EOL> println ( top5 . toString ( ) ) <EOL> } <EOL> } <EOL> }

/**
 * This examples demonstrates the light-weight inference API with [ImageRecognitionModel] on EfficientNetB7 model:
 * - Model is obtained from [ONNXModelHub].
 * - Model predicts on a few images located in resources.
 */


= efficientNetB7LightAPIPrediction ( )


public fun < R > CameraXCompatibleModel . doWithRotation ( rotation : Int , function : ( ) -> R ) : R

{ <EOL> val currentRotation = targetRotation <EOL> targetRotation = rotation <EOL> return function ( ) . apply { targetRotation = currentRotation } <EOL> }

/**
 * Convenience function to execute arbitrary code with a preliminary updated target rotation.
 * After the code is executed, the target rotation is restored to its original value.
 *
 * @param rotation target rotation to be set for the duration of the code execution
 * @param function arbitrary code to be executed
 */


public fun getAllPossibleNames ( ) : Set < Name >

= withValidityAssertion { <EOL> getPossibleCallableNames ( ) + getPossibleClassifierNames ( ) <EOL> }

/**
 * Returns a **superset** of names which current scope may contain.
 * In other words `ALL_NAMES(scope)` is a subset of `scope.getAllNames()`
 */


public fun getPossibleCallableNames ( ) : Set < Name >

/**
 * Returns a **superset** of callable names which current scope may contain.
 * In other words `ALL_CALLABLE_NAMES(scope)` is a subset of `scope.getCallableNames()`
 */


public fun getPossibleClassifierNames ( ) : Set < Name >

/**
 * Returns a **superset** of classifier names which current scope may contain.
 * In other words `ALL_CLASSIFIER_NAMES(scope)` is a subset of `scope.getClassifierNames()`
 */


public fun mayContainName ( name : Name ) : Boolean

= withValidityAssertion { <EOL> name in getPossibleCallableNames ( ) || name in getPossibleClassifierNames ( ) <EOL> }

/**
 * return true if the scope may contain name, false otherwise.
 *
 * In other words `(mayContainName(name) == false) => (name !in scope)`; vice versa is not always true
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun < T > ( suspend ( ) -> T ) . startCoroutineUninterceptedOrReturn ( completion : Continuation < T > ) : Any ?

{ <EOL> val wrappedCompletion = wrapWithContinuationImpl ( completion ) <EOL> val function = this as? Function1 < Continuation < T > , Any ? > <EOL> return if ( function == null ) <EOL> startCoroutineUninterceptedOrReturnFallback ( this , wrappedCompletion ) <EOL> else <EOL> function . invoke ( wrappedCompletion ) <EOL> }

/**
 * Starts an unintercepted coroutine without a receiver and with result type [T] and executes it until its first suspension.
 * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
 * In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.
 *
 * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
 * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
 * context is established.
 *
 * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of the suspended
 * coroutine using a reference to the suspending function.
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> @ kotlin . internal . InlineOnly <EOL> public actual inline fun < R , T > ( suspend R . ( ) -> T ) . startCoroutineUninterceptedOrReturn ( receiver : R , completion : Continuation < T > ) : Any ?

{ <EOL> val wrappedCompletion = wrapWithContinuationImpl ( completion ) <EOL> val function = this as? Function2 < R , Continuation < T > , Any ? > <EOL> return if ( function == null ) <EOL> startCoroutineUninterceptedOrReturnFallback ( this , receiver , wrappedCompletion ) <EOL> else <EOL> function . invoke ( receiver , wrappedCompletion ) <EOL> }

/**
 * Starts an unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.
 * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.
 * In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.
 *
 * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might
 * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation
 * context is established.
 *
 * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of the suspended
 * coroutine using a reference to the suspending function.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> public actual fun < T > ( suspend ( ) -> T ) . createCoroutineUnintercepted ( completion : Continuation < T > ) : Continuation < Unit >

{ <EOL> val probeCompletion = probeCoroutineCreated ( completion ) <EOL> return if ( this is BaseContinuationImpl ) <EOL> create ( probeCompletion ) <EOL> else <EOL> createCoroutineFromSuspendFunction ( probeCompletion ) { <EOL> this . startCoroutineUninterceptedOrReturn ( it ) <EOL> } <EOL> }

/**
 * Creates unintercepted coroutine without receiver and with result type [T].
 * This function creates a new, fresh instance of suspendable computation every time it is invoked.
 *
 * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
 * The [completion] continuation is invoked when coroutine completes with result or exception.
 *
 * This function returns unintercepted continuation.
 * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the
 * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
 * It is the invoker's responsibility to ensure that a proper invocation context is established.
 * Note that [completion] of this function may get invoked in an arbitrary context.
 *
 * [Continuation.intercepted] can be used to acquire the intercepted continuation.
 * Invocation of `resume(Unit)` on intercepted continuation guarantees that execution of
 * both the coroutine and [completion] happens in the invocation context established by
 * [ContinuationInterceptor].
 *
 * Repeated invocation of any resume function on the resulting continuation corrupts the
 * state machine of the coroutine and may result in arbitrary behaviour or exception.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> public actual fun < R , T > ( suspend R . ( ) -> T ) . createCoroutineUnintercepted ( receiver : R , completion : Continuation < T > ) : Continuation < Unit >

{ <EOL> val probeCompletion = probeCoroutineCreated ( completion ) <EOL> return if ( this is BaseContinuationImpl ) <EOL> create ( receiver , probeCompletion ) <EOL> else { <EOL> createCoroutineFromSuspendFunction ( probeCompletion ) { <EOL> this . startCoroutineUninterceptedOrReturn ( receiver , it ) <EOL> } <EOL> } <EOL> }

/**
 * Creates unintercepted coroutine with receiver type [R] and result type [T].
 * This function creates a new, fresh instance of suspendable computation every time it is invoked.
 *
 * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.
 * The [completion] continuation is invoked when coroutine completes with result or exception.
 *
 * This function returns unintercepted continuation.
 * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the
 * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].
 * It is the invoker's responsibility to ensure that a proper invocation context is established.
 * Note that [completion] of this function may get invoked in an arbitrary context.
 *
 * [Continuation.intercepted] can be used to acquire the intercepted continuation.
 * Invocation of `resume(Unit)` on intercepted continuation guarantees that execution of
 * both the coroutine and [completion] happens in the invocation context established by
 * [ContinuationInterceptor].
 *
 * Repeated invocation of any resume function on the resulting continuation corrupts the
 * state machine of the coroutine and may result in arbitrary behaviour or exception.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> public actual fun < T > Continuation < T > . intercepted ( ) : Continuation < T >

= <EOL> ( this as? ContinuationImpl ) ? . intercepted ( ) ? : this

/**
 * Intercepts this continuation with [ContinuationInterceptor].
 *
 * This function shall be used on the immediate result of [createCoroutineUnintercepted] or [suspendCoroutineUninterceptedOrReturn],
 * in which case it checks for [ContinuationInterceptor] in the continuation's [context][Continuation.context],
 * invokes [ContinuationInterceptor.interceptContinuation], caches and returns the result.
 *
 * If this function is invoked on other [Continuation] instances it returns `this` continuation unchanged.
 */


@ SinceKotlin ( "<STR_LIT:1.3>" ) <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> private inline fun < T > createCoroutineFromSuspendFunction ( completion : Continuation < T > , crossinline block : ( Continuation < T > ) -> Any ? <EOL> ) : Continuation < Unit >

{ <EOL> val context = completion . context <EOL> return if ( context === EmptyCoroutineContext ) <EOL> object : RestrictedContinuationImpl ( completion as Continuation < Any ? > ) { <EOL> private var label = <NUM_LIT:0> <EOL> override fun invokeSuspend ( result : Result < Any ? > ) : Any ? = <EOL> when ( label ) { <EOL> <NUM_LIT:0> -> { <EOL> label = <NUM_LIT:1> <EOL> result . getOrThrow ( ) <EOL> block ( this ) <EOL> } <EOL> <NUM_LIT:1> -> { <EOL> label = <NUM_LIT:2> <EOL> result . getOrThrow ( ) <EOL> } <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> else <EOL> object : ContinuationImpl ( completion as Continuation < Any ? > , context ) { <EOL> private var label = <NUM_LIT:0> <EOL> override fun invokeSuspend ( result : Result < Any ? > ) : Any ? = <EOL> when ( label ) { <EOL> <NUM_LIT:0> -> { <EOL> label = <NUM_LIT:1> <EOL> result . getOrThrow ( ) <EOL> block ( this ) <EOL> } <EOL> <NUM_LIT:1> -> { <EOL> label = <NUM_LIT:2> <EOL> result . getOrThrow ( ) <EOL> } <EOL> else -> error ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }

/**
 * This function is used when [createCoroutineUnintercepted] encounters suspending lambda that does not extend BaseContinuationImpl.
 *
 * It happens in two cases:
 * 1. Callable reference to suspending function,
 * 2. Suspending function reference implemented by Java code.
 *
 * We must wrap it into an instance that extends [BaseContinuationImpl], because that is an expectation of all coroutines machinery.
 * As an optimization we use lighter-weight [RestrictedContinuationImpl] base class (it has less fields) if the context is
 * [EmptyCoroutineContext], and a full-blown [ContinuationImpl] class otherwise.
 *
 * The instance of [BaseContinuationImpl] is passed to the [block] so that it can be passed to the corresponding invocation.
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> internal inline fun createContinuationArgumentFromCallback ( completion : Continuation < Unit > , crossinline callback : ( Result < Any ? > ) -> Unit ) : Continuation < Any ? >

= object : ContinuationImpl ( completion as Continuation < Any ? > ) { <EOL> private var invoked = false <EOL> override fun invokeSuspend ( result : Result < Any ? > ) : Any ? { <EOL> if ( invoked ) error ( "<STR_LIT>" ) <EOL> invoked = true <EOL> callback ( result ) <EOL> return Unit <EOL> } <EOL> }

/**
 * This function creates continuation suitable for passing as implicit argument to suspend functions.
 * The continuation calls [callback] and then delegates to [completion].
 *
 * The result is [ContinuationImpl] because that is an expectation of all coroutines machinery.
 *
 * It can be thought as a state machine of
 * ```
 * suspend fun foo() {
 * val result = runCatching { <suspended here> }
 * callback(result)
 * }
 * ```
 */


@ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> private fun < T > createSimpleCoroutineForSuspendFunction ( completion : Continuation < T > ) : Continuation < T >

{ <EOL> val context = completion . context <EOL> return if ( context === EmptyCoroutineContext ) <EOL> object : RestrictedContinuationImpl ( completion as Continuation < Any ? > ) { <EOL> override fun invokeSuspend ( result : Result < Any ? > ) : Any ? { <EOL> return result . getOrThrow ( ) <EOL> } <EOL> } <EOL> else <EOL> object : ContinuationImpl ( completion as Continuation < Any ? > , context ) { <EOL> override fun invokeSuspend ( result : Result < Any ? > ) : Any ? { <EOL> return result . getOrThrow ( ) <EOL> } <EOL> } <EOL> }

/**
 * This function is used when [startCoroutineUninterceptedOrReturn] encounters suspending lambda that does not extend BaseContinuationImpl.
 *
 * It happens in two cases: callable reference to suspending function or tail-call lambdas.
 *
 * This function is the same as above, but does not run lambda itself - the caller is expected to call [invoke] manually.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < D : Dim2 > LinAlg . solve ( a : MultiArray < Float , D2 > , b : MultiArray < Float , D > ) : NDArray < Float , D >

= this . linAlgEx . solveF ( a , b )

/**
 * Solves a linear matrix equation, or system of linear scalar equations.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < T : Number , D : Dim2 > LinAlg . solve ( a : MultiArray < T , D2 > , b : MultiArray < T , D > ) : NDArray < Double , D >

= this . linAlgEx . solve ( a , b )


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < T : Complex , D : Dim2 > LinAlg . solve ( a : MultiArray < T , D2 > , b : MultiArray < T , D > ) : NDArray < T , D >

= this . linAlgEx . solveC ( a , b )


@ HtmlTagMarker <EOL> inline fun OBJECT . param ( name : String ? = null , value : String ? = null , crossinline block : PARAM . ( ) -> Unit = { } ) : Unit

= PARAM ( attributesMapOf ( "<STR_LIT:name>" , name , "<STR_LIT:value>" , value ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun OL . li ( classes : String ? = null , crossinline block : LI . ( ) -> Unit = { } ) : Unit

= LI ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> inline fun OPTGROUP . option ( classes : String ? = null , crossinline block : OPTION . ( ) -> Unit = { } ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( block )


@ HtmlTagMarker <EOL> fun OPTGROUP . option ( classes : String ? = null , content : String = "<STR_LIT>" ) : Unit

= OPTION ( attributesMapOf ( "<STR_LIT:class>" , classes ) , consumer ) . visit ( { + content } )


internal fun PhaseEngine < NativeGenerationState > . runAllLowerings ( irModuleFragment : IrModuleFragment )

{ <EOL> val lowerings = getAllLowerings ( ) <EOL> irModuleFragment . files . forEach { file -> <EOL> context . fileLowerState = FileLowerState ( ) <EOL> lowerings . fold ( file ) { loweredFile , lowering -> <EOL> runPhase ( lowering , loweredFile ) <EOL> } <EOL> } <EOL> }

/**
 * Run whole IR lowering pipeline over [irModuleFragment].
 */


internal fun addBuildEventsListenerRegistryMock ( project : Project )

{ <EOL> val executedExtensionKey = "<STR_LIT>" <EOL> try { <EOL> if ( project . findExtension < Boolean > ( executedExtensionKey ) == true ) return <EOL> val projectScopeServices = ( project as DefaultProject ) . services as ProjectScopeServices <EOL> val state : Field = ProjectScopeServices :: class . java . superclass . getDeclaredField ( "<STR_LIT>" ) <EOL> state . isAccessible = true <EOL> @ Suppress ( "<STR_LIT:UNCHECKED_CAST>" ) <EOL> val stateValue : AtomicReference < Any > = state . get ( projectScopeServices ) as AtomicReference < Any > <EOL> val enumClass = Class . forName ( DefaultServiceRegistry :: class . java . name + "<STR_LIT>" ) <EOL> stateValue . set ( enumClass . enumConstants [ <NUM_LIT:0> ] ) <EOL> projectScopeServices . add ( BuildEventsListenerRegistry :: class . java , BuildEventsListenerRegistryMock ) <EOL> stateValue . set ( enumClass . enumConstants [ <NUM_LIT:1> ] ) <EOL> project . addExtension ( executedExtensionKey , true ) <EOL> } catch ( e : Throwable ) { <EOL> throw RuntimeException ( e ) <EOL> } <EOL> }

/**
 * In Gradle 6.7-rc-1 BuildEventsListenerRegistry service is not created in we need it in order
 * to instantiate AGP. This creates a fake one and injects it - http://b/168630734.
 * https://github.com/gradle/gradle/issues/16774 (Waiting for Gradle 7.5)
 */


internal fun binarySearchRange ( array : IntArray , needle : Int ) : Int

{ <EOL> var bottom = <NUM_LIT:0> <EOL> var top = array . size - <NUM_LIT:1> <EOL> var middle = - <NUM_LIT:1> <EOL> var value = <NUM_LIT:0> <EOL> while ( bottom <= top ) { <EOL> middle = ( bottom + top ) / <NUM_LIT:2> <EOL> value = array [ middle ] <EOL> if ( needle > value ) <EOL> bottom = middle + <NUM_LIT:1> <EOL> else if ( needle == value ) <EOL> return middle <EOL> else <EOL> top = middle - <NUM_LIT:1> <EOL> } <EOL> return middle - ( if ( needle < value ) <NUM_LIT:1> else <NUM_LIT:0> ) <EOL> }

/**
 * Returns the index of the largest element in [array] smaller or equal to the specified [needle],
 * or -1 if [needle] is smaller than the smallest element in [array].
 */


internal fun Char . digitToIntImpl ( ) : Int

{ <EOL> val ch = this . code <EOL> val index = binarySearchRange ( rangeStart , ch ) <EOL> val diff = ch - rangeStart [ index ] <EOL> return if ( diff < <NUM_LIT:10> ) diff else - <NUM_LIT:1> <EOL> }

/**
 * Returns an integer from 0..9 indicating the digit this character represents,
 * or -1 if this character is not a digit.
 */


internal fun Char . isDigitImpl ( ) : Boolean

{ <EOL> return digitToIntImpl ( ) >= <NUM_LIT:0> <EOL> }

/**
 * Returns `true` if this character is a digit.
 */


private infix fun < T : Comparable < T > > ClosedRange < T > . joinable ( other : ClosedRange < T > ) : Boolean

{ <EOL> return ( other . start in this ) || ( other . endInclusive in this ) || ( start in other ) <EOL> }


@ Test <EOL> fun createZeroFilledByteArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < Byte > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < Byte > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 createOneDimensionalArrayFromByteList ( )

{ <EOL> val list = listOf < Byte > ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Byte > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromByteSet ( )

{ <EOL> val set = setOf < Byte > ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Byte > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveByteArray ( )

{ <EOL> val array = byteArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Byte > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createByte1DArrayWithInitializationFunction ( )

{ <EOL> val a = mk . d1array < Byte > ( <NUM_LIT:5> ) { ( it + <NUM_LIT:3> ) . toByte ( ) } <EOL> val expected = byteArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-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 createByte1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < Byte > = mk . ndarrayOf ( <NUM_LIT:1> . toByte ( ) , <NUM_LIT:3> . toByte ( ) , <NUM_LIT:8> . toByte ( ) , <NUM_LIT:4> . toByte ( ) , <NUM_LIT:9> . toByte ( ) ) <EOL> val expected = byteArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from bytes
 * and checks if the array's ByteArray representation matches the expected output.
 */


@ Test <EOL> fun generateArangeByteArrayWithStep ( )

{ <EOL> val a = mk . arange < Byte > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = byteArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Byte type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeByteArrayWithNonIntegerStep ( )

{ <EOL> val a = mk . arange < Byte > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = byteArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Byte type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a non-integer step of 2.5.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeByteArrayWithDefaultStart ( )

{ <EOL> val a = mk . arange < Byte > ( <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = byteArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Byte type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeByteArrayWithDefaultStartAndNonIntegerStep ( )

{ <EOL> val a = mk . arange < Byte > ( <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = byteArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Byte type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a non-integer step of 2.3.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceByteArray ( )

{ <EOL> val a = mk . linspace < Byte > ( <NUM_LIT:3> , <NUM_LIT:10> , num = <NUM_LIT> ) <EOL> val expected = byteArrayOf ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:9> , <NUM_LIT:10> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getByteArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `linspace` for the Byte type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 3 to 10 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceByteArrayWithNonIntegerBounds ( )

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

/**
 * Tests the function `linspace` for the Byte type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 1.7 to 13.8 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun convertIterableToByteArrayNDArray ( )

{ <EOL> val expected = listOf < Byte > ( <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:0> ) <EOL> val a = expected . toNDArray ( ) <EOL> assertEquals ( expected . size , a . size ) <EOL> assertEquals ( expected , a . toList ( ) ) <EOL> }

/**
 * Tests the function `toNDArray` which converts an Iterable<Byte> to a one-dimensional NDArray.
 * The test creates a list of bytes, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


@ Test <EOL> fun createZeroFilledShortArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < Short > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < Short > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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> fun createOneDimensionalArrayFromShortList ( )

{ <EOL> val list = listOf < Short > ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Short > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


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

{ <EOL> val set = setOf < Short > ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Short > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveShortArray ( )

{ <EOL> val array = shortArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Short > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createShort1DArrayWithInitializationFunction ( )

{ <EOL> val a = mk . d1array < Short > ( <NUM_LIT:5> ) { ( it + <NUM_LIT:3> ) . toShort ( ) } <EOL> val expected = shortArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-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 createShort1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < Short > = mk . ndarrayOf ( <NUM_LIT:1> . toShort ( ) , <NUM_LIT:3> . toShort ( ) , <NUM_LIT:8> . toShort ( ) , <NUM_LIT:4> . toShort ( ) , <NUM_LIT:9> . toShort ( ) ) <EOL> val expected = shortArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from shorts
 * and checks if the array's ShortArray representation matches the expected output.
 */


@ Test <EOL> fun generateArangeShortArrayWithStep ( )

{ <EOL> val a = mk . arange < Short > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = shortArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Short type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeShortArrayWithNonIntegerStep ( )

{ <EOL> val a = mk . arange < Short > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = shortArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Short type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a non-integer step of 2.5.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeShortArrayWithDefaultStart ( )

{ <EOL> val a = mk . arange < Short > ( <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = shortArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Short type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeShortArrayWithDefaultStartAndNonIntegerStep ( )

{ <EOL> val a = mk . arange < Short > ( <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = shortArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Short type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a non-integer step of 2.3.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceShortArray ( )

{ <EOL> val a = mk . linspace < Short > ( <NUM_LIT:3> , <NUM_LIT:10> , num = <NUM_LIT> ) <EOL> val expected = shortArrayOf ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:9> , <NUM_LIT:10> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getShortArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `linspace` for the Short type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 3 to 10 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceShortArrayWithNonIntegerBounds ( )

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

/**
 * Tests the function `linspace` for the Short type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 1.7 to 13.8 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


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

{ <EOL> val expected = listOf < Short > ( <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:0> ) <EOL> val a = expected . toNDArray ( ) <EOL> assertEquals ( expected . size , a . size ) <EOL> assertEquals ( expected , a . toList ( ) ) <EOL> }

/**
 * Tests the function `toNDArray` which converts an Iterable<Short> to a one-dimensional NDArray.
 * The test creates a list of Shorts, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


@ Test <EOL> fun createZeroFilledIntArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < Int > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < Int > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 createOneDimensionalArrayFromIntList ( )

{ <EOL> val list = listOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Int > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromIntSet ( )

{ <EOL> val set = setOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Int > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveIntArray ( )

{ <EOL> val array = intArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Int > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createInt1DArrayWithInitializationFunction ( )

{ <EOL> val a = mk . d1array < Int > ( <NUM_LIT:5> ) { ( it + <NUM_LIT:3> ) } <EOL> val expected = intArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-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 createInt1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < Int > = mk . ndarrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val expected = intArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from integers
 * and checks if the array's IntArray representation matches the expected output.
 */


@ Test <EOL> fun generateArangeIntArrayWithStep ( )

{ <EOL> val a = mk . arange < Int > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = intArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Int type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeIntArrayWithNonIntegerStep ( )

{ <EOL> val a = mk . arange < Int > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = intArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Int type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a non-integer step of 2.5.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeIntArrayWithDefaultStart ( )

{ <EOL> val a = mk . arange < Int > ( <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = intArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Int type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeIntArrayWithDefaultStartAndNonIntegerStep ( )

{ <EOL> val a = mk . arange < Int > ( <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = intArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Int type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a non-integer step of 2.3.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceIntArray ( )

{ <EOL> val a = mk . linspace < Int > ( <NUM_LIT:3> , <NUM_LIT:10> , num = <NUM_LIT> ) <EOL> val expected = intArrayOf ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:9> , <NUM_LIT:10> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getIntArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `linspace` for the Int type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 3 to 10 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceIntArrayWithNonIntegerBounds ( )

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

/**
 * Tests the function `linspace` for the Int type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 1.7 to 13.8 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun convertIterableToIntArrayNDArray ( )

{ <EOL> val expected = listOf ( <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:0> ) <EOL> val a = expected . toNDArray ( ) <EOL> assertEquals ( expected . size , a . size ) <EOL> assertEquals ( expected , a . toList ( ) ) <EOL> }

/**
 * Tests the function `toNDArray` which converts an Iterable<Int> to a one-dimensional NDArray.
 * The test creates a list of Ints, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


@ Test <EOL> fun createZeroFilledLongArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < Long > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < Long > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 createOneDimensionalArrayFromLongList ( )

{ <EOL> val list = listOf < Long > ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Long > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromLongSet ( )

{ <EOL> val set = setOf < Long > ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Long > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveLongArray ( )

{ <EOL> val array = longArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> val a : D1Array < Long > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createLong1DArrayWithInitializationFunction ( )

{ <EOL> val a = mk . d1array < Long > ( <NUM_LIT:5> ) { it + <NUM_LIT:3L> } <EOL> val expected = longArrayOf ( <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:7> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-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 createLong1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < Long > = mk . ndarrayOf ( <NUM_LIT:1L> , <NUM_LIT:3L> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val expected = longArrayOf ( <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT:4> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from longs
 * and checks if the array's LongArray representation matches the expected output.
 */


@ Test <EOL> fun generateArangeLongArrayWithStep ( )

{ <EOL> val a = mk . arange < Long > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = longArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Long type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeLongArrayWithNonIntegerStep ( )

{ <EOL> val a = mk . arange < Long > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = longArrayOf ( <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Long type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a non-integer step of 2.5.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeLongArrayWithDefaultStart ( )

{ <EOL> val a = mk . arange < Long > ( <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = longArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:8> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Long type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeLongArrayWithDefaultStartAndNonIntegerStep ( )

{ <EOL> val a = mk . arange < Long > ( <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = longArrayOf ( <NUM_LIT:0> , <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:6> , <NUM_LIT:9> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Long type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a non-integer step of 2.3.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceLongArray ( )

{ <EOL> val a = mk . linspace < Long > ( <NUM_LIT:3> , <NUM_LIT:10> , num = <NUM_LIT> ) <EOL> val expected = longArrayOf ( <NUM_LIT:3> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:6> , <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:7> , <NUM_LIT:8> , <NUM_LIT:8> , <NUM_LIT:9> , <NUM_LIT:9> , <NUM_LIT:10> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getLongArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `linspace` for the Long type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 3 to 10 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceLongArrayWithNonIntegerBounds ( )

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

/**
 * Tests the function `linspace` for the Long type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 1.7 to 13.8 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun convertIterableToLongArrayNDArray ( )

{ <EOL> val expected = listOf < Long > ( <NUM_LIT:3> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT:2> , <NUM_LIT:0> ) <EOL> val a = expected . toNDArray ( ) <EOL> assertEquals ( expected . size , a . size ) <EOL> assertEquals ( expected , a . toList ( ) ) <EOL> }

/**
 * Tests the function `toNDArray` which converts an Iterable<Long> to a one-dimensional NDArray.
 * The test creates a list of Longs, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


@ Test <EOL> fun createZeroFilledFloatArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < Float > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < Float > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 createOneDimensionalArrayFromFloatList ( )

{ <EOL> val list = listOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val a : D1Array < Float > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromFloatSet ( )

{ <EOL> val set = setOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val a : D1Array < Float > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveFloatArray ( )

{ <EOL> val array = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val a : D1Array < Float > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createFloat1DArrayWithInitializationFunction ( )

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

/**
 * Creates a one-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 createFloat1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < Float > = mk . ndarrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val expected = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from floats
 * and checks if the array's FloatArray representation matches the expected output.
 */


@ Test <EOL> fun generateArangeFloatArrayWithStep ( )

{ <EOL> val a = mk . arange < Float > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Float type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeFloatArrayWithNonIntegerStep ( )

{ <EOL> val a = mk . arange < Float > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Float type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a non-integer step of 2.5.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeFloatArrayWithDefaultStart ( )

{ <EOL> val a = mk . arange < Float > ( <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Float type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeFloatArrayWithDefaultStartAndNonIntegerStep ( )

{ <EOL> val a = mk . arange < Float > ( <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = floatArrayOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Float type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a non-integer step of 2.3.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceFloatArray ( )

{ <EOL> val a = mk . linspace < Float > ( <NUM_LIT:3> , <NUM_LIT:10> , num = <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> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `linspace` for the Float type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 3 to 10 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceFloatArrayWithNonIntegerBounds ( )

{ <EOL> val a = mk . linspace < Float > ( <NUM_LIT> , <NUM_LIT> , num = <NUM_LIT> ) . map { round ( it * <NUM_LIT> ) / <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> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getFloatArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `linspace` for the Float type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 1.7 to 13.8 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun convertIterableToFloatArrayNDArray ( )

{ <EOL> val expected = listOf ( <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val a = expected . toNDArray ( ) <EOL> assertEquals ( expected . size , a . size ) <EOL> assertEquals ( expected , a . toList ( ) ) <EOL> }

/**
 * Tests the function `toNDArray` which converts an Iterable<Float> to a one-dimensional NDArray.
 * The test creates a list of Floats, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


@ Test <EOL> fun createZeroFilledDoubleArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < Double > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < Double > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 createOneDimensionalArrayFromDoubleList ( )

{ <EOL> val list = listOf ( <NUM_LIT:1.0> , <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val a : D1Array < Double > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromDoubleSet ( )

{ <EOL> val set = setOf ( <NUM_LIT:1.0> , <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val a : D1Array < Double > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveDoubleArray ( )

{ <EOL> val array = doubleArrayOf ( <NUM_LIT:1.0> , <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val a : D1Array < Double > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createDouble1DArrayWithInitializationFunction ( )

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

/**
 * Creates a one-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 createDouble1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < Double > = mk . ndarrayOf ( <NUM_LIT:1.0> , <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> val expected = doubleArrayOf ( <NUM_LIT:1.0> , <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from Doubles
 * and checks if the array's DoubleArray representation matches the expected output.
 */


@ Test <EOL> fun generateArangeDoubleArrayWithStep ( )

{ <EOL> val a = mk . arange < Double > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = doubleArrayOf ( <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Double type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeDoubleArrayWithNonIntegerStep ( )

{ <EOL> val a = mk . arange < Double > ( <NUM_LIT:3> , <NUM_LIT:10> , step = <NUM_LIT> ) <EOL> val expected = doubleArrayOf ( <NUM_LIT:3.0> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Double type.
 * The function is supposed to generate an array starting from 3, ending before 10, with a non-integer step of 2.5.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeDoubleArrayWithDefaultStart ( )

{ <EOL> val a = mk . arange < Double > ( <NUM_LIT:10> , step = <NUM_LIT:2> ) <EOL> val expected = doubleArrayOf ( <NUM_LIT:0.0> , <NUM_LIT:2.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Double type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a step of 2.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateArangeDoubleArrayWithDefaultStartAndNonIntegerStep ( )

{ <EOL> val a = mk . arange < Double > ( <NUM_LIT:10> , step = <NUM_LIT> ) . map { round ( it * <NUM_LIT> ) / <NUM_LIT> } <EOL> val expected = doubleArrayOf ( <NUM_LIT:0.0> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `arange` for the Double type.
 * The function is supposed to generate an array starting from the default start value of 0,
 * ending before 10, with a non-integer step of 2.3.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceDoubleArray ( )

{ <EOL> val a = mk . linspace < Double > ( <NUM_LIT:3> , <NUM_LIT:10> , num = <NUM_LIT> ) <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> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Tests the function `linspace` for the Double type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 3 to 10 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun generateLinspaceDoubleArrayWithNonIntegerBounds ( )

{ <EOL> val a = mk . linspace < Double > ( <NUM_LIT> , <NUM_LIT> , num = <NUM_LIT> ) . map { round ( it * <NUM_LIT> ) / <NUM_LIT> } <EOL> val expected = doubleArrayOf ( <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> }

/**
 * Tests the function `linspace` for the Double type.
 * The function is supposed to generate an array of 15 elements evenly spaced from 1.7 to 13.8 inclusive.
 * The created array is then checked against an expected array for both size and element equality.
 */


@ Test <EOL> fun convertIterableToDoubleArrayNDArray ( )

/**
 * Tests the function `toNDArray` which converts an Iterable<Double> to a one-dimensional NDArray.
 * The test creates a list of Doubles, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


@ Test <EOL> fun createZeroFilledComplexFloatArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < ComplexFloat > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < ComplexFloat > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 createOneDimensionalArrayFromComplexFloatList ( )

{ <EOL> val list = complexFloatList <EOL> val a : D1Array < ComplexFloat > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromComplexFloatSet ( )

{ <EOL> val set = complexFloatList . toSet ( ) <EOL> val a : D1Array < ComplexFloat > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveComplexFloatArray ( )

{ <EOL> val array = complexFloatList . toComplexFloatArray ( ) <EOL> val a : D1Array < ComplexFloat > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getComplexFloatArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createComplexFloat1DArrayWithInitializationFunction ( )

{ <EOL> val a = mk . d1array < ComplexFloat > ( <NUM_LIT:5> ) { ComplexFloat ( it + <NUM_LIT> , round ( ( it - <NUM_LIT> ) * <NUM_LIT> ) / <NUM_LIT> ) } <EOL> val expected = <EOL> 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 ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexFloatArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-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 createComplexFloat1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < ComplexFloat > = mk . ndarrayOf ( <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> 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 ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexFloatArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from floats
 * and checks if the array's ComplexFloatArray representation matches the expected output.
 */


@ Test <EOL> fun convertIterableToComplexFloatArrayNDArray ( )

{ <EOL> val expected = listOf ( ComplexFloat ( <NUM_LIT> , <NUM_LIT> ) , ComplexFloat ( <NUM_LIT> , <NUM_LIT> ) , ComplexFloat ( <NUM_LIT> , <NUM_LIT> ) , ComplexFloat ( <NUM_LIT> , <NUM_LIT> ) , ComplexFloat ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> val a = expected . toNDArray ( ) <EOL> assertEquals ( expected . size , a . size ) <EOL> assertEquals ( expected , a . toList ( ) ) <EOL> }

/**
 * Tests the function `toNDArray` which converts an Iterable<ComplexFloat> to a one-dimensional NDArray.
 * The test creates a list of ComplexFloats, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


@ Test <EOL> fun createZeroFilledComplexDoubleArray ( )

{ <EOL> val size = <NUM_LIT:10> <EOL> val a = mk . zeros < ComplexDouble > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 size = <NUM_LIT:10> <EOL> val a = mk . ones < ComplexDouble > ( size ) <EOL> assertEquals ( size , a . size ) <EOL> assertEquals ( size , 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 createOneDimensionalArrayFromComplexDoubleList ( )

{ <EOL> val list = complexDoubleList <EOL> val a : D1Array < ComplexDouble > = mk . ndarray ( list ) <EOL> assertEquals ( list , a . toList ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromComplexDoubleSet ( )

{ <EOL> val set = complexDoubleList . toSet ( ) <EOL> val a : D1Array < ComplexDouble > = mk . ndarray ( set , shape = intArrayOf ( <NUM_LIT:5> ) ) <EOL> assertEquals ( set . size , a . size ) <EOL> assertEquals ( set , a . toSet ( ) ) <EOL> }

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


@ Test <EOL> fun createOneDimensionalArrayFromPrimitiveComplexDoubleArray ( )

{ <EOL> val array = complexDoubleList . toComplexDoubleArray ( ) <EOL> val a : D1Array < ComplexDouble > = mk . ndarray ( array ) <EOL> assertEquals ( array . size , a . size ) <EOL> a . data . getComplexDoubleArray ( ) shouldBe array <EOL> }

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


@ Test <EOL> fun createComplexDouble1DArrayWithInitializationFunction ( )

{ <EOL> val a = mk . d1array < ComplexDouble > ( <NUM_LIT:5> ) { ComplexDouble ( it + <NUM_LIT> , round ( ( it - <NUM_LIT> ) * <NUM_LIT> ) / <NUM_LIT> ) } <EOL> val expected = <EOL> 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 ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-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 createComplexDouble1DArrayWithNdarrayOf ( )

{ <EOL> val a : D1Array < ComplexDouble > = <EOL> mk . ndarrayOf ( <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> val expected = <EOL> 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 ) <EOL> assertEquals ( expected . size , a . size ) <EOL> a . data . getComplexDoubleArray ( ) shouldBe expected <EOL> }

/**
 * Creates a one-dimensional array with a given size from doubles
 * and checks if the array's ComplexDoubleArray representation matches the expected output.
 */


@ Test <EOL> fun convertIterableToComplexDoubleArrayNDArray ( )

{ <EOL> val expected = listOf ( <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> val a = expected . toNDArray ( ) <EOL> assertEquals ( expected . size , a . size ) <EOL> assertEquals ( expected , a . toList ( ) ) <EOL> }

/**
 * Tests the function `toNDArray` which converts an Iterable<ComplexDouble> to a one-dimensional NDArray.
 * The test creates a list of ComplexDoubles, converts it to an NDArray,
 * and then checks that the size and elements of the NDArray match those of the original list.
 */


fun checkSubTypes ( types : List < ConeKotlinType > , context : CheckerContext ) : Boolean

{ <EOL> fun replaceTypeParametersByStarProjections ( type : ConeClassLikeType ) : ConeClassLikeType { <EOL> return type . withArguments ( type . typeArguments . map { <EOL> when { <EOL> it . isStarProjection -> it <EOL> it . type ! ! is ConeTypeParameterType -> ConeStarProjection <EOL> it . type ! ! is ConeClassLikeType -> replaceTypeParametersByStarProjections ( it . type as ConeClassLikeType ) <EOL> else -> it <EOL> } <EOL> } . toTypedArray ( ) ) <EOL> } <EOL> val replacedTypeParameters = types . flatMap { r -> <EOL> when ( r ) { <EOL> is ConeTypeParameterType -> r . lookupTag . typeParameterSymbol . resolvedBounds . map { it . type } <EOL> is ConeClassLikeType -> listOf ( replaceTypeParametersByStarProjections ( r ) ) <EOL> else -> listOf ( r ) <EOL> } <EOL> } <EOL> for ( i in replacedTypeParameters . indices ) <EOL> for ( j in i + <NUM_LIT:1> ..< replacedTypeParameters . size ) { <EOL> if ( replacedTypeParameters [ i ] . isSubtypeOf ( replacedTypeParameters [ j ] , context . session ) || replacedTypeParameters [ j ] . isSubtypeOf ( replacedTypeParameters [ i ] , context . session ) ) <EOL> return true <EOL> } <EOL> return false <EOL> }

/**
 * Simplified checking of subtype relation used in context receiver checkers.
 * It converts type parameters to star projections and top level type parameters to its supertypes. Then it checks the relation.
 */


public fun predictObject ( image : I ) : String

{ <EOL> val input = preprocessing . apply ( image ) <EOL> return classLabels [ internalModel . predictLabel ( input ) ] ! ! <EOL> }

/**
 * Predicts an object for the given [image].
 * Default preprocessing [Operation] is applied to an image.
 *
 * @param [image] Input image.
 * @see preprocessing
 *
 * @return The label of the recognized object with the highest probability.
 */


public fun predictTopKObjects ( image : I , topK : Int = <NUM_LIT:5> ) : List < Pair < String , Float > >

{ <EOL> val input = preprocessing . apply ( image ) <EOL> return internalModel . predictTopNLabels ( input , classLabels , topK ) <EOL> }

/**
 * Predicts [topK] objects for the given [image].
 * Default preprocessing [Operation] is applied to an image.
 *
 * @param [image] Input image.
 * @param [topK] Number of top-ranked predictions to return
 *
 * @see preprocessing
 *
 * @return The list of pairs <label, probability> sorted from the most probable to the lowest probable.
 */


fun Sequence < String > . ifNotContainsSequence ( patternsIter : Iterator < LinePattern > , body : ( LinePattern , Int ) -> Unit ) : Unit

{ <EOL> class Accumulator ( it : Iterator < LinePattern > ) { <EOL> val iter = EndBoundIteratorWithValue ( it ) <EOL> var lineNo = <NUM_LIT:1> <EOL> var lastMatchedLineNo = <NUM_LIT:0> <EOL> fun nextLineAndPattern ( ) : Accumulator { iter . traverseNext ( ) ; lastMatchedLineNo = lineNo ; return nextLine ( ) } <EOL> fun nextLine ( ) : Accumulator { lineNo ++ ; return this } <EOL> } <EOL> val res = fold ( Accumulator ( patternsIter ) ) <EOL> { acc , line -> <EOL> when { <EOL> ! acc . iter . isValid ( ) -> return@fold acc <EOL> acc . iter . value . regex . find ( line ) ? . let { acc . iter . value . matchCheck ( it ) } ? : false -> acc . nextLineAndPattern ( ) <EOL> else -> acc . nextLine ( ) <EOL> } <EOL> } <EOL> if ( res . iter . isValid ( ) ) { <EOL> body ( res . iter . value , res . lastMatchedLineNo ) <EOL> } <EOL> }

/**
 * calls [body] if receiver does not contain complete sequence of lines matched by [patternsIter], separated by any number of other lines
 * [body] receives first unmatched pattern and index of last matched line in the sequence
 */


fun Sequence < String > . ifNotContainsSequence ( patterns : List < LinePattern > , body : ( LinePattern , Int ) -> Unit ) : Unit

{ <EOL> ifNotContainsSequence ( patterns . iterator ( ) , body ) <EOL> }

/**
 * calls [body] if receiver does not contain complete sequence of lines matched by [patterns], separated by any number of other lines
 * [body] receives first unmatched pattern and index of last matched line in the sequence
 */


fun Sequence < String > . ifNotContainsSequence ( vararg patterns : LinePattern , body : ( LinePattern , Int ) -> Unit ) : Unit


fun prepare ( buildErrorExpected : Boolean ? = false )


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sin ( x : Double ) : Double

= nativeMath . sin ( x )

/** Computes the sine of the angle [x] given in radians.
 *
 * Special cases:
 * - `sin(NaN|+Inf|-Inf)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun cos ( x : Double ) : Double

= nativeMath . cos ( x )

/** Computes the cosine of the angle [x] given in radians.
 *
 * Special cases:
 * - `cos(NaN|+Inf|-Inf)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun tan ( x : Double ) : Double

= nativeMath . tan ( x )

/** Computes the tangent of the angle [x] given in radians.
 *
 * Special cases:
 * - `tan(NaN|+Inf|-Inf)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun asin ( x : Double ) : Double

= nativeMath . asin ( x )

/**
 * Computes the arc sine of the value [x];
 * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
 *
 * Special cases:
 * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun acos ( x : Double ) : Double

= nativeMath . acos ( x )

/**
 * Computes the arc cosine of the value [x];
 * the returned value is an angle in the range from `0.0` to `PI` radians.
 *
 * Special cases:
 * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun atan ( x : Double ) : Double

= nativeMath . atan ( x )

/**
 * Computes the arc tangent of the value [x];
 * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
 *
 * Special cases:
 * - `atan(NaN)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun atan2 ( y : Double , x : Double ) : Double

= nativeMath . atan2 ( y , x )

/**
 * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond
 * to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];
 * the returned value is an angle in the range from `-PI` to `PI` radians.
 *
 * Special cases:
 * - `atan2(0.0, 0.0)` is `0.0`
 * - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`
 * - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`
 * - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`
 * - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`
 * - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`
 * - `atan2(+Inf, x)` is `PI/2` for finite `x`y
 * - `atan2(-Inf, x)` is `-PI/2` for finite `x`
 * - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sinh ( x : Double ) : Double

= nativeMath . sinh ( x )

/**
 * Computes the hyperbolic sine of the value [x].
 *
 * Special cases:
 * - `sinh(NaN)` is `NaN`
 * - `sinh(+Inf)` is `+Inf`
 * - `sinh(-Inf)` is `-Inf`
 */