peachsim 0.1.1692 → 0.1.1700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bridge-flow-runner.ts +61 -39
- package/cli/commands/agent-wrapper.ts +21 -10
- package/cli/commands/control.ts +27 -7
- package/cli/commands/coverage.ts +1 -1
- package/cli/commands/detect.ts +17 -4
- package/cli/commands/maestro-compare.ts +25 -99
- package/cli/help-core.ts +3 -4
- package/cli/maestro-compare.ts +172 -4
- package/cli/outbound-endpoints.ts +2 -10
- package/detox/index.ts +15 -0
- package/detox/launch-permissions.ts +169 -0
- package/dist-lib/agent-daemon-client.cjs +2 -2
- package/dist-lib/agent-events.cjs +2 -2
- package/dist-lib/attached-projects.cjs +2 -2
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +2 -2
- package/dist-lib/beta.cjs +2 -2
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +2 -2
- package/dist-lib/bridge-contract-input.cjs +2 -2
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -2
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +18273 -15925
- package/dist-lib/capture-contract.cjs +2 -2
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +2 -2
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +2 -2
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -2
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +2 -2
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +104 -3
- package/dist-lib/dev-bundle-resolution.cjs +208 -44
- package/dist-lib/expo-swift-bundle.cjs +2349 -1778
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +2 -2
- package/dist-lib/host/bridge-host.cjs +7885 -3334
- package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
- package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +2 -2
- package/dist-lib/host/websocket-proxy.cjs +2 -2
- package/dist-lib/index.cjs +297 -77
- package/dist-lib/jump-to-source-babel.cjs +2 -2
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +2 -2
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +2 -2
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +2 -2
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +294 -74
- package/dist-lib/native-app-identity-project.cjs +48 -37
- package/dist-lib/native-app-identity-project.mjs +47 -36
- package/dist-lib/native-app-identity.cjs +2 -2
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +2 -2
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +2 -2
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/public-origins-lib-esm.json +24 -23
- package/dist-lib/public-origins-lib.json +199 -79
- package/dist-lib/react-native-host-modules.cjs +2 -2
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +19600 -15992
- package/dist-lib/swift-compile.cjs +640 -402
- package/dist-lib/swift-compile.mjs +595 -357
- package/dist-lib/swift-package.cjs +24 -20
- package/dist-lib/swift-package.mjs +23 -19
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +31 -4
- package/dist-lib/swift.cjs +2 -2
- package/dist-lib/vite-swift.cjs +1559 -1208
- package/dist-lib/vite.cjs +251 -42
- package/dist-lib/worklet-executable.cjs +2 -2
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
- package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
- package/sdk/ios/usr/include/copyfile.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
- package/sdk/ios/usr/include/malloc/_platform.h +80 -0
- package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
- package/sdk/ios/usr/include/malloc/malloc.h +768 -0
- package/sdk/ios/usr/include/os/availability.h +168 -6
- package/sdk/ios/usr/include/os/base.h +351 -0
- package/sdk/ios/usr/include/os/clock.h +18 -0
- package/sdk/ios/usr/include/os/lock.h +232 -10
- package/sdk/ios/usr/include/os/log.h +521 -38
- package/sdk/ios/usr/include/os/object.h +320 -3
- package/sdk/ios/usr/include/os/trace.h +492 -0
- package/sdk/ios/usr/include/os/trace_base.h +167 -0
- package/sdk/ios/usr/include/os/workgroup.h +37 -0
- package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
- package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
- package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
- package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
- package/sdk/ios/usr/include/sys/cdefs.h +38 -0
- package/sdk/ios/wasm/include/unistd.h +3 -0
- package/skills/contrast/SKILL.md +3 -0
- package/src/codex-client.ts +11 -6
- package/src/dev-bundle-resolution.ts +124 -48
- package/src/expo-native-workspace.ts +176 -0
- package/src/expo-swift-host.ts +161 -26
- package/src/expo-swift-ready.ts +14 -28
- package/src/expoSwiftContract.ts +4 -1
- package/src/generated/swift-c-predefines.json +68 -12
- package/src/host/bridge-host.ts +5 -0
- package/src/installed-package-versions.ts +14 -1
- package/src/metro-project-root.ts +44 -33
- package/src/native-app-identity-project.ts +1 -0
- package/src/nitro-adapter.lock.json +916 -10
- package/src/nitro-adapter.ts +33 -24
- package/src/nitro-bundle.ts +108 -22
- package/src/nitro-compile.ts +32 -5
- package/src/nitro-source.ts +13 -3
- package/src/nitroAdapterContract.ts +100 -20
- package/src/node-http-fetch.ts +116 -0
- package/src/packageVersionsContract.ts +46 -0
- package/src/serverDiscoveryContract.ts +1 -0
- package/src/settingsContract.ts +0 -30
- package/src/swift-binary-modules.ts +20 -5
- package/src/swift-compile.ts +168 -48
- package/src/swift-coverage/xcode-assets.ts +4 -3
- package/src/swift-host.ts +14 -3
- package/src/swift-objc-compile.ts +32 -5
- package/src/swift-objc-metadata.ts +2 -2
- package/src/swift-objc-platform.ts +2 -2
- package/src/swift-objc-standin.ts +43 -13
- package/src/swift-package.ts +33 -26
- package/src/swift-source-pods.ts +126 -41
- package/src/swift-standin-digest.ts +77 -0
- package/src/swift-standin-emit.ts +40 -4
- package/src/swift-standins.ts +68 -19
- package/src/swift-toolchain.ts +38 -0
- package/src/swiftContract.ts +8 -0
- package/src/vite-plugin.ts +0 -10
- package/src/xcode-project.ts +62 -42
- package/src/settings-flags.ts +0 -107
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
#ifndef SPARSE_SOLVE_HEADER
|
|
2
|
+
#error "Do not include this header directly."
|
|
3
|
+
#endif
|
|
4
|
+
|
|
5
|
+
#include <TargetConditionals.h>
|
|
6
|
+
|
|
7
|
+
/* MARK: Implementation of the option-less public interfaces; simply defer
|
|
8
|
+
* to the versions with options, using the `_SparseDefaultXXXOptions` objects
|
|
9
|
+
* defined here. */
|
|
10
|
+
static const SparseSymbolicFactorOptions _SparseDefaultSymbolicFactorOptions = {
|
|
11
|
+
.control = SparseDefaultControl,
|
|
12
|
+
.orderMethod = SparseOrderDefault,
|
|
13
|
+
.order = NULL,
|
|
14
|
+
.ignoreRowsAndColumns = NULL,
|
|
15
|
+
.malloc = malloc,
|
|
16
|
+
.free = free
|
|
17
|
+
};
|
|
18
|
+
static const SparseNumericFactorOptions _SparseDefaultNumericFactorOptions_Double = {
|
|
19
|
+
.control = SparseDefaultControl,
|
|
20
|
+
.scalingMethod = SparseScalingDefault,
|
|
21
|
+
.scaling = NULL,
|
|
22
|
+
.pivotTolerance = 0.01, // Recommended value for difficult matrices in double
|
|
23
|
+
.zeroTolerance = 1e-4 * __DBL_EPSILON__, // "A few" orders of magnitude below epsilon.
|
|
24
|
+
};
|
|
25
|
+
static const SparseNumericFactorOptions _SparseDefaultNumericFactorOptions_Float = {
|
|
26
|
+
.control = SparseDefaultControl,
|
|
27
|
+
.scalingMethod = SparseScalingDefault,
|
|
28
|
+
.scaling = NULL,
|
|
29
|
+
.pivotTolerance = 0.1, // Recommended value for difficult matrices in float
|
|
30
|
+
.zeroTolerance = 1e-4 * __FLT_EPSILON__, // "A few" orders of magnitude below epsilon.
|
|
31
|
+
};
|
|
32
|
+
static const SparseNumericFactorOptions _SparseDefaultNumericFactorOptions_Complex_Double = {
|
|
33
|
+
.control = SparseDefaultControl,
|
|
34
|
+
.scalingMethod = SparseScalingDefault,
|
|
35
|
+
.scaling = NULL,
|
|
36
|
+
.pivotTolerance = 0.01, // Recommended value for difficult matrices in double
|
|
37
|
+
.zeroTolerance = 1e-4 * __DBL_EPSILON__, // "A few" orders of magnitude below epsilon.
|
|
38
|
+
};
|
|
39
|
+
static const SparseNumericFactorOptions _SparseDefaultNumericFactorOptions_Complex_Float = {
|
|
40
|
+
.control = SparseDefaultControl,
|
|
41
|
+
.scalingMethod = SparseScalingDefault,
|
|
42
|
+
.scaling = NULL,
|
|
43
|
+
.pivotTolerance = 0.1, // Recommended value for difficult matrices in float
|
|
44
|
+
.zeroTolerance = 1e-4 * __FLT_EPSILON__, // "A few" orders of magnitude below epsilon.
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
48
|
+
SparseOpaqueSymbolicFactorization SparseFactor(SparseFactorization_t type,
|
|
49
|
+
SparseMatrixStructure Matrix) {
|
|
50
|
+
return SparseFactor(type, Matrix, _SparseDefaultSymbolicFactorOptions);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
54
|
+
SparseOpaqueSymbolicFactorization SparseFactor(SparseFactorization_t type,
|
|
55
|
+
SparseMatrixStructureComplex Matrix) {
|
|
56
|
+
return SparseFactor(type, Matrix, _SparseDefaultSymbolicFactorOptions);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* MARK: Macros and inlines used to implement the public interfaces. */
|
|
60
|
+
#include <stdlib.h>
|
|
61
|
+
#include <stdio.h>
|
|
62
|
+
|
|
63
|
+
#ifndef __has_builtin
|
|
64
|
+
# define __has_builtin(_) 0
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
#if __has_builtin(__builtin_mul_overflow)
|
|
68
|
+
# define sparse_mul_overflow(a, b, res) __builtin_mul_overflow((a), (b), (res))
|
|
69
|
+
#else
|
|
70
|
+
/* Workaround if mul_overflow is unavailable. */
|
|
71
|
+
# define sparse_mul_overflow(a, b, res) (*(res) = (long)(a)*(b), false)
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
#if __has_include(<os/log.h>)
|
|
75
|
+
# include <os/log.h>
|
|
76
|
+
#else
|
|
77
|
+
# define os_log_error(_, format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
#ifndef SPARSE_PARAMETER_CHECK
|
|
81
|
+
#define SPARSE_PARAMETER_CHECK(condition, result, format, ...) \
|
|
82
|
+
do { \
|
|
83
|
+
if (!(condition)) { \
|
|
84
|
+
if (options.reportError) { \
|
|
85
|
+
char message[256] = { 0 }; \
|
|
86
|
+
snprintf(message, 256, format, ##__VA_ARGS__); \
|
|
87
|
+
options.reportError(message); \
|
|
88
|
+
} else { \
|
|
89
|
+
os_log_error(OS_LOG_DEFAULT, format, ##__VA_ARGS__); \
|
|
90
|
+
_SparseTrap(); \
|
|
91
|
+
} \
|
|
92
|
+
return result; \
|
|
93
|
+
} \
|
|
94
|
+
} while (0)
|
|
95
|
+
#endif /* SPARSE_PARAMETER_CHECK*/
|
|
96
|
+
|
|
97
|
+
// Do O(1) validity tests for matrix structure
|
|
98
|
+
#ifndef SPARSE_CHECK_VALID_MATRIX_STRUCTURE
|
|
99
|
+
#define SPARSE_CHECK_VALID_MATRIX_STRUCTURE_COMMON(S, result) \
|
|
100
|
+
SPARSE_PARAMETER_CHECK((S).rowCount > 0, result, "%s.rowCount must be > 0, but is %d.\n", #S, (S).rowCount); \
|
|
101
|
+
SPARSE_PARAMETER_CHECK((S).columnCount > 0, result, "%s.columnCount must be > 0, but is %d.\n", #S, (S).rowCount); \
|
|
102
|
+
SPARSE_PARAMETER_CHECK((S).blockSize > 0, result, "%s.blockSize must be > 0, but is %d.]n", #S, (S).blockSize); \
|
|
103
|
+
SPARSE_PARAMETER_CHECK((S).attributes.kind != SparseSymmetric || \
|
|
104
|
+
(S).rowCount == (S).columnCount, result, \
|
|
105
|
+
"%s.attributes.kind=SparseSymmetric, but %s.rowCount (%d) != %s.columnCount (%d).\n", \
|
|
106
|
+
#S, #S, (S).rowCount, #S, (S).columnCount);
|
|
107
|
+
#if !0
|
|
108
|
+
// Add check for SparseHermitian
|
|
109
|
+
#define SPARSE_CHECK_VALID_MATRIX_STRUCTURE(S, result) \
|
|
110
|
+
SPARSE_CHECK_VALID_MATRIX_STRUCTURE_COMMON(S, result) \
|
|
111
|
+
SPARSE_PARAMETER_CHECK((S).attributes.kind != SparseHermitian || \
|
|
112
|
+
(S).rowCount == (S).columnCount, result, \
|
|
113
|
+
"%s.attributes.kind=SparseHermitian, but %s.rowCount (%d) != %s.columnCount (%d).\n", \
|
|
114
|
+
#S, #S, (S).rowCount, #S, (S).columnCount);
|
|
115
|
+
#endif
|
|
116
|
+
#endif /* SPARSE_CHECK_VALID_MATRIX_STRUCTURE */
|
|
117
|
+
|
|
118
|
+
// Check matrix matches symbolic factor
|
|
119
|
+
#ifndef SPARSE_CHECK_MATCH_SYMB_FACTOR
|
|
120
|
+
#define SPARSE_CHECK_MATCH_SYMB_FACTOR(A, sf, result) \
|
|
121
|
+
SPARSE_PARAMETER_CHECK((A).structure.rowCount == (sf).rowCount && \
|
|
122
|
+
(A).structure.columnCount == (sf).columnCount && \
|
|
123
|
+
(A).structure.blockSize == (sf).blockSize && \
|
|
124
|
+
(A).structure.attributes.transpose == (sf).attributes.transpose, \
|
|
125
|
+
result, "%s does not match that used for symbolic factorization stored in %s.\n", \
|
|
126
|
+
#A, #sf);
|
|
127
|
+
#endif /* SPARSE_CHECK_MATCH_SYMB_FACTOR */
|
|
128
|
+
|
|
129
|
+
// Check symbolic factorization is valid for use
|
|
130
|
+
#ifndef SPARSE_CHECK_VALID_SYMBOLIC_FACTOR
|
|
131
|
+
#define SPARSE_CHECK_VALID_SYMBOLIC_FACTOR(sf, result, format, ...) \
|
|
132
|
+
SPARSE_PARAMETER_CHECK((sf).status == SparseStatusOK && \
|
|
133
|
+
(sf).factorization, \
|
|
134
|
+
result, format, ##__VA_ARGS__);
|
|
135
|
+
#endif /* SPARSE_CHECK_VALID_SYMBOLIC_FACTOR */
|
|
136
|
+
|
|
137
|
+
// Check numeric factorization is valid for use
|
|
138
|
+
#ifndef SPARSE_CHECK_VALID_NUMERIC_FACTOR
|
|
139
|
+
#define SPARSE_CHECK_VALID_NUMERIC_FACTOR(nf, result) \
|
|
140
|
+
SPARSE_PARAMETER_CHECK((nf).symbolicFactorization.status == SparseStatusOK && \
|
|
141
|
+
(nf).symbolicFactorization.factorization && \
|
|
142
|
+
(nf).status == SparseStatusOK && \
|
|
143
|
+
(nf).numericFactorization, \
|
|
144
|
+
result, \
|
|
145
|
+
"%s does not hold a completed matrix factorization.\n", #nf);
|
|
146
|
+
#endif /* SPARSE_CHECK_VALID_NUMERIC_FACTOR */
|
|
147
|
+
|
|
148
|
+
// Check if two vectors are consistent with operation Y = (Op) X.
|
|
149
|
+
// (Op) is given as an expected xSize and and expected ySize in this case.
|
|
150
|
+
#ifndef SPARSE_CHECK_CONSISTENT_MAT_OUT_PLACE
|
|
151
|
+
#define SPARSE_CHECK_CONSISTENT_MAT_OUT_PLACE(expectedXSize, expectedYSize, X, Y, result, opName) \
|
|
152
|
+
do { \
|
|
153
|
+
SPARSE_PARAMETER_CHECK((X).columnStride >= (X).rowCount, result, \
|
|
154
|
+
"%s.columnStride (%d) must be at least %s.rowCount (%d).\n", \
|
|
155
|
+
#X, (X).columnStride, #X, (X).rowCount); \
|
|
156
|
+
SPARSE_PARAMETER_CHECK((Y).columnStride >= (Y).rowCount, result, \
|
|
157
|
+
"%s.columnStride (%d) must be at least %s.rowCount (%d).\n", \
|
|
158
|
+
#Y, (Y).columnStride, #Y, (Y).rowCount); \
|
|
159
|
+
int xCount = ((X).attributes.transpose) ? (X).rowCount : (X).columnCount; \
|
|
160
|
+
int yCount = ((Y).attributes.transpose) ? (Y).rowCount : (Y).columnCount; \
|
|
161
|
+
int xSize = ((X).attributes.transpose) ? (X).columnCount : (X).rowCount; \
|
|
162
|
+
int ySize = ((Y).attributes.transpose) ? (Y).columnCount : (Y).rowCount; \
|
|
163
|
+
SPARSE_PARAMETER_CHECK(xCount == yCount, result, \
|
|
164
|
+
"%s (%dx%d) and %s (%dx%d) do not represent the same number of right-hand sides.\n", \
|
|
165
|
+
#X, xSize, xCount, #Y, ySize, yCount); \
|
|
166
|
+
SPARSE_PARAMETER_CHECK(xCount > 0, result, \
|
|
167
|
+
"%s (%dx%d) must represent at least one right-hand side.\n", \
|
|
168
|
+
#X, xSize, xCount); \
|
|
169
|
+
SPARSE_PARAMETER_CHECK(xSize == expectedXSize, result, \
|
|
170
|
+
"%s (size %dx%d) does not match dimensions of %s (%d x %d).\n", \
|
|
171
|
+
#X, xSize, xCount, opName, expectedYSize, expectedXSize); \
|
|
172
|
+
SPARSE_PARAMETER_CHECK(ySize == expectedYSize, result, \
|
|
173
|
+
"%s (size %dx%d) does not match dimensions of %s (%d x %d).\n", \
|
|
174
|
+
#Y, ySize, yCount, opName, expectedYSize, expectedXSize); \
|
|
175
|
+
} while(0)
|
|
176
|
+
#endif /* SPARSE_CHECK_CONSISTENT_MAT_OUT_PLACE */
|
|
177
|
+
|
|
178
|
+
// Check if vector is consistent with numeric factor for in-place solve
|
|
179
|
+
#ifndef SPARSE_CHECK_CONSISTENT_DS_VEC_IN_PLACE
|
|
180
|
+
#define SPARSE_CHECK_CONSISTENT_DS_VEC_IN_PLACE(nf, vec, result) \
|
|
181
|
+
do { \
|
|
182
|
+
int blockSize = (nf).symbolicFactorization.blockSize; \
|
|
183
|
+
int m = (nf).symbolicFactorization.rowCount * blockSize; \
|
|
184
|
+
int n = (nf).symbolicFactorization.columnCount * blockSize; \
|
|
185
|
+
int maxmn = (m>n) ? m : n; \
|
|
186
|
+
SPARSE_PARAMETER_CHECK((vec).count == maxmn, result, \
|
|
187
|
+
"%s.count (%d) is not equal to largest dimension of matrix factorization %s.\n", \
|
|
188
|
+
#vec, (vec).count, #nf); \
|
|
189
|
+
} while(0)
|
|
190
|
+
#endif /* SPARSE_CHECK_CONSISTENT_DS_VEC_IN_PLACE */
|
|
191
|
+
|
|
192
|
+
// Check if matrix is consistent with numeric factor for in-place solve
|
|
193
|
+
#ifndef SPARSE_CHECK_CONSISTENT_DS_MAT_IN_PLACE
|
|
194
|
+
#define SPARSE_CHECK_CONSISTENT_DS_MAT_IN_PLACE(nf, mat, result) \
|
|
195
|
+
do { \
|
|
196
|
+
SPARSE_PARAMETER_CHECK((mat).columnStride >= (mat).rowCount, result, \
|
|
197
|
+
"%s.columnStride (%d) must be at least %s.rowCount (%d).\n", \
|
|
198
|
+
#mat, (mat).columnStride, #mat, (mat).rowCount); \
|
|
199
|
+
int matSize = ((mat).attributes.transpose) ? (mat).columnCount : (mat).rowCount; \
|
|
200
|
+
int matCount = ((mat).attributes.transpose) ? (mat).rowCount : (mat).columnCount; \
|
|
201
|
+
SPARSE_PARAMETER_CHECK(matCount > 0, result, \
|
|
202
|
+
"%s (%dx%d) must represent at least one right-hand side.\n", \
|
|
203
|
+
#mat, matSize, matCount); \
|
|
204
|
+
int blockSize = (nf).symbolicFactorization.blockSize; \
|
|
205
|
+
int m = (nf).symbolicFactorization.rowCount * blockSize; \
|
|
206
|
+
int n = (nf).symbolicFactorization.columnCount * blockSize; \
|
|
207
|
+
int maxmn = (m>n) ? m : n; \
|
|
208
|
+
SPARSE_PARAMETER_CHECK(matSize == maxmn, result, \
|
|
209
|
+
"%s (%dx%d) is not consistent with largest dimension of matrix factorization %s (%d).\n", \
|
|
210
|
+
#mat, matSize, matCount, #nf, maxmn); \
|
|
211
|
+
} while(0)
|
|
212
|
+
#endif /* SPARSE_CHECK_CONSISTENT_DS_MAT_IN_PLACE */
|
|
213
|
+
|
|
214
|
+
// Check if vectors are consistent with numeric factor for out-of-place solve
|
|
215
|
+
#ifndef SPARSE_CHECK_CONSISTENT_DS_VEC_OUT_PLACE
|
|
216
|
+
#define SPARSE_CHECK_CONSISTENT_DS_VEC_OUT_PLACE(nf, b, x, result) \
|
|
217
|
+
do { \
|
|
218
|
+
bool trans = Factored.symbolicFactorization.attributes.transpose ^ Factored.attributes.transpose; \
|
|
219
|
+
int blockSize = (nf).symbolicFactorization.blockSize; \
|
|
220
|
+
int rc = (nf).symbolicFactorization.rowCount * blockSize; \
|
|
221
|
+
int cc = (nf).symbolicFactorization.columnCount * blockSize; \
|
|
222
|
+
int m = trans ? cc : rc; \
|
|
223
|
+
int n = trans ? rc : cc; \
|
|
224
|
+
int expectXSize = n; \
|
|
225
|
+
int expectBSize = ((nf).symbolicFactorization.type == SparseFactorizationQR) ? m : n; \
|
|
226
|
+
SPARSE_PARAMETER_CHECK((x).count == expectXSize, result, \
|
|
227
|
+
"%s (size %dx1) does not match dimensions of matrix factorization %s (%d x %d).\n", \
|
|
228
|
+
#x, (x).count, #nf, expectBSize, expectXSize); \
|
|
229
|
+
SPARSE_PARAMETER_CHECK((b).count == expectBSize, result, \
|
|
230
|
+
"%s (size %dx1) does not match dimensions of matrix factorization %s (%d x %d).\n", \
|
|
231
|
+
#b, (b).count, #nf, expectBSize, expectXSize); \
|
|
232
|
+
} while(0)
|
|
233
|
+
#endif /* SPARSE_CHECK_CONSISTENT_DS_VEC_OUT_PLACE */
|
|
234
|
+
|
|
235
|
+
// Check if matrices are consistent with numeric factor and each other for out-of-place solve
|
|
236
|
+
#ifndef SPARSE_CHECK_CONSISTENT_DS_MAT_OUT_PLACE
|
|
237
|
+
#define SPARSE_CHECK_CONSISTENT_DS_MAT_OUT_PLACE(nf, B, X, result) \
|
|
238
|
+
do { \
|
|
239
|
+
bool trans = Factored.symbolicFactorization.attributes.transpose ^ Factored.attributes.transpose; \
|
|
240
|
+
int blockSize = (nf).symbolicFactorization.blockSize; \
|
|
241
|
+
int rc = (nf).symbolicFactorization.rowCount * blockSize; \
|
|
242
|
+
int cc = (nf).symbolicFactorization.columnCount * blockSize; \
|
|
243
|
+
int m = trans ? cc : rc; \
|
|
244
|
+
int n = trans ? rc : cc; \
|
|
245
|
+
int expectedXSize = n; \
|
|
246
|
+
int expectedBSize = ((nf).symbolicFactorization.type == SparseFactorizationQR) ? m : n; \
|
|
247
|
+
SPARSE_CHECK_CONSISTENT_MAT_OUT_PLACE(expectedBSize, expectedXSize, B, X, result, "matrix factorization "#nf); \
|
|
248
|
+
} while(0)
|
|
249
|
+
#endif /* SPARSE_CHECK_CONSISTENT_DS_VEC_OUT_PLACE */
|
|
250
|
+
|
|
251
|
+
/* Iterative Methods */
|
|
252
|
+
SPARSE_ENUM(_SparseIterativeMethod, int,
|
|
253
|
+
/*! @abstract Conjugate Gradient */
|
|
254
|
+
_SparseMethodCG = 0,
|
|
255
|
+
/*! @abstract GMRES or variant */
|
|
256
|
+
_SparseMethodGMRES = 1,
|
|
257
|
+
/*! @abstract LSMR (Least Squares MINRES) */
|
|
258
|
+
_SparseMethodLSMR = 2,
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
/* MARK: External functions used to implement the public interfaces. */
|
|
262
|
+
#if defined __cplusplus
|
|
263
|
+
extern "C" {
|
|
264
|
+
#endif
|
|
265
|
+
|
|
266
|
+
#if __has_feature(nullability)
|
|
267
|
+
#pragma clang assume_nonnull begin
|
|
268
|
+
#endif
|
|
269
|
+
|
|
270
|
+
API_AVAILABLE( macos(10.13), ios(11), watchos(4), tvos(11) )
|
|
271
|
+
extern SparseOpaqueSymbolicFactorization _SparseSymbolicFactorSymmetric
|
|
272
|
+
(SparseFactorization_t factorType,
|
|
273
|
+
const SparseMatrixStructure *Matrix,
|
|
274
|
+
const SparseSymbolicFactorOptions *options);
|
|
275
|
+
|
|
276
|
+
API_AVAILABLE( macos(10.13), ios(11), watchos(4), tvos(11) )
|
|
277
|
+
extern SparseOpaqueSymbolicFactorization _SparseSymbolicFactorQR
|
|
278
|
+
(SparseFactorization_t factorType,
|
|
279
|
+
const SparseMatrixStructure *Matrix,
|
|
280
|
+
const SparseSymbolicFactorOptions *options);
|
|
281
|
+
|
|
282
|
+
API_AVAILABLE( macos(15.5), ios(18.5), watchos(11.5), tvos(18.5), visionos(2.5) )
|
|
283
|
+
extern SparseOpaqueSymbolicFactorization _SparseSymbolicFactorLU
|
|
284
|
+
(SparseFactorization_t factorType,
|
|
285
|
+
const SparseMatrixStructure *Matrix,
|
|
286
|
+
const SparseSymbolicFactorOptions *options);
|
|
287
|
+
|
|
288
|
+
API_AVAILABLE( macos(10.13), ios(11), watchos(4), tvos(11) )
|
|
289
|
+
extern void _SparseRetainSymbolic(SparseOpaqueSymbolicFactorization *_Nonnull symbolicFactor);
|
|
290
|
+
|
|
291
|
+
API_AVAILABLE( macos(10.13), ios(11), watchos(4), tvos(11) )
|
|
292
|
+
extern void _SparseDestroyOpaqueSymbolic(SparseOpaqueSymbolicFactorization *toFree);
|
|
293
|
+
|
|
294
|
+
API_AVAILABLE( macos(10.13), ios(11), watchos(4), tvos(11) )
|
|
295
|
+
extern SparseSymbolicFactorOptions _SparseGetOptionsFromSymbolicFactor(SparseOpaqueSymbolicFactorization *factor);
|
|
296
|
+
|
|
297
|
+
API_AVAILABLE( macos(10.13), ios(11), watchos(4), tvos(11) )
|
|
298
|
+
extern void _SparseTrap(void);
|
|
299
|
+
|
|
300
|
+
API_AVAILABLE( macos(15.5), ios(18.5), watchos(11.5), tvos(18.5), visionos(2.5) )
|
|
301
|
+
extern SparseKind_t _SparseFromKindComplex(SparseKind_t K);
|
|
302
|
+
|
|
303
|
+
API_AVAILABLE( macos(15.5), ios(18.5), watchos(11.5), tvos(18.5), visionos(2.5) )
|
|
304
|
+
extern SparseKind_t _SparseToKindComplex(SparseKind_t K);
|
|
305
|
+
|
|
306
|
+
API_AVAILABLE( macos(15.5), ios(18.5), watchos(11.5), tvos(18.5), visionos(2.5) )
|
|
307
|
+
extern SparseAttributes_t _SparseFromAttributeComplex(SparseAttributesComplex_t K);
|
|
308
|
+
|
|
309
|
+
API_AVAILABLE( macos(15.5), ios(18.5), watchos(11.5), tvos(18.5), visionos(2.5) )
|
|
310
|
+
extern SparseAttributesComplex_t _SparseToAttributeComplex(SparseAttributes_t K);
|
|
311
|
+
|
|
312
|
+
API_AVAILABLE( macos(15.5), ios(18.5), watchos(11.5), tvos(18.5), visionos(2.5) )
|
|
313
|
+
extern SparseMatrixStructure _SparseFromStructureComplex(SparseMatrixStructureComplex K);
|
|
314
|
+
|
|
315
|
+
API_AVAILABLE( macos(15.5), ios(18.5), watchos(11.5), tvos(18.5), visionos(2.5) )
|
|
316
|
+
extern SparseMatrixStructureComplex _SparseToStructureComplex(SparseMatrixStructure K);
|
|
317
|
+
|
|
318
|
+
#if __has_feature(nullability)
|
|
319
|
+
#pragma clang assume_nonnull end
|
|
320
|
+
#endif
|
|
321
|
+
|
|
322
|
+
#if defined __cplusplus
|
|
323
|
+
} /* extern "C" */
|
|
324
|
+
#endif
|
|
325
|
+
|
|
326
|
+
/* MARK: Implementation of the expert-mode public interfaces. */
|
|
327
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
328
|
+
SparseOpaqueSymbolicFactorization SparseFactor(SparseFactorization_t type, SparseMatrixStructure Matrix, SparseSymbolicFactorOptions options) {
|
|
329
|
+
SPARSE_PARAMETER_CHECK(Matrix.columnCount > 0,
|
|
330
|
+
(SparseOpaqueSymbolicFactorization){ .status = SparseParameterError },
|
|
331
|
+
".structure.columnCount must be greater than 0.\n");
|
|
332
|
+
switch(type) {
|
|
333
|
+
case SparseFactorizationCholeskyAtA:
|
|
334
|
+
case SparseFactorizationQR:
|
|
335
|
+
return _SparseSymbolicFactorQR(type, &Matrix, &options);
|
|
336
|
+
#if !0
|
|
337
|
+
case SparseFactorizationLU:
|
|
338
|
+
case SparseFactorizationLUUnpivoted:
|
|
339
|
+
case SparseFactorizationLUSPP:
|
|
340
|
+
case SparseFactorizationLUTPP:
|
|
341
|
+
return _SparseSymbolicFactorLU(type, &Matrix, &options);
|
|
342
|
+
#endif // !TARGET_OS_BRIDGE
|
|
343
|
+
default:
|
|
344
|
+
SPARSE_PARAMETER_CHECK(Matrix.attributes.kind == SparseSymmetric,
|
|
345
|
+
(SparseOpaqueSymbolicFactorization){ .status = SparseParameterError },
|
|
346
|
+
"Requested symmetric factorization of non-symmetric matrix.\n");
|
|
347
|
+
SPARSE_PARAMETER_CHECK(Matrix.rowCount == Matrix.columnCount,
|
|
348
|
+
(SparseOpaqueSymbolicFactorization){ .status = SparseParameterError },
|
|
349
|
+
"Matrix supposed to be symmetric (Hermitian), but rowCount != columnCount.\n");
|
|
350
|
+
return _SparseSymbolicFactorSymmetric(type, &Matrix, &options);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
#if !0
|
|
355
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
356
|
+
SparseOpaqueSymbolicFactorization SparseFactor(SparseFactorization_t type, SparseMatrixStructureComplex MatrixComplex, SparseSymbolicFactorOptions options) {
|
|
357
|
+
SparseMatrixStructure Matrix = _SparseFromStructureComplex(MatrixComplex);
|
|
358
|
+
SPARSE_PARAMETER_CHECK(Matrix.columnCount > 0,
|
|
359
|
+
(SparseOpaqueSymbolicFactorization){ .status = SparseParameterError },
|
|
360
|
+
".structure.columnCount must be greater than 0.\n");
|
|
361
|
+
switch(type) {
|
|
362
|
+
case SparseFactorizationCholeskyAtA:
|
|
363
|
+
case SparseFactorizationQR:
|
|
364
|
+
return _SparseSymbolicFactorQR(type, &Matrix, &options);
|
|
365
|
+
case SparseFactorizationLU:
|
|
366
|
+
case SparseFactorizationLUUnpivoted:
|
|
367
|
+
case SparseFactorizationLUSPP:
|
|
368
|
+
case SparseFactorizationLUTPP:
|
|
369
|
+
return _SparseSymbolicFactorLU(type, &Matrix, &options);
|
|
370
|
+
default:
|
|
371
|
+
|
|
372
|
+
SPARSE_PARAMETER_CHECK(Matrix.attributes.kind == SparseSymmetric ||
|
|
373
|
+
Matrix.attributes.kind == SparseHermitian,
|
|
374
|
+
(SparseOpaqueSymbolicFactorization){ .status = SparseParameterError },
|
|
375
|
+
"Requested symmetric factorization of non-symmetric (non-Hermitian) matrix.\n");
|
|
376
|
+
SPARSE_PARAMETER_CHECK(Matrix.rowCount == Matrix.columnCount,
|
|
377
|
+
(SparseOpaqueSymbolicFactorization){ .status = SparseParameterError },
|
|
378
|
+
"Matrix supposed to be symmetric (Hermitian), but rowCount != columnCount.\n");
|
|
379
|
+
return _SparseSymbolicFactorSymmetric(type, &Matrix, &options);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
#endif // !TARGET_OS_BRIDGE
|
|
383
|
+
|
|
384
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
385
|
+
SparseOpaqueSymbolicFactorization SparseRetain(SparseOpaqueSymbolicFactorization SymbolicFactor) {
|
|
386
|
+
SparseSymbolicFactorOptions options = _SparseDefaultSymbolicFactorOptions;
|
|
387
|
+
SPARSE_PARAMETER_CHECK(SymbolicFactor.status == SparseStatusOK && SymbolicFactor.factorization,
|
|
388
|
+
(SparseOpaqueSymbolicFactorization){ .status = SparseParameterError },
|
|
389
|
+
"Can only retain valid symbolic factorizations.\n");
|
|
390
|
+
_SparseRetainSymbolic(&SymbolicFactor);
|
|
391
|
+
return SymbolicFactor;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
395
|
+
void SparseCleanup(SparseOpaqueSymbolicFactorization toFree) {
|
|
396
|
+
_SparseDestroyOpaqueSymbolic(&toFree);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
400
|
+
SparseIterativeMethod SparseConjugateGradient(void) {
|
|
401
|
+
SparseIterativeMethod result = {
|
|
402
|
+
.method = _SparseMethodCG,
|
|
403
|
+
.options.cg = (SparseCGOptions) {}
|
|
404
|
+
};
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
409
|
+
SparseIterativeMethod SparseConjugateGradient(SparseCGOptions options) {
|
|
410
|
+
SparseIterativeMethod result = {
|
|
411
|
+
.method = _SparseMethodCG,
|
|
412
|
+
.options.cg = options
|
|
413
|
+
};
|
|
414
|
+
return result;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
418
|
+
SparseIterativeMethod SparseGMRES(void) {
|
|
419
|
+
SparseIterativeMethod result = {
|
|
420
|
+
.method = _SparseMethodGMRES,
|
|
421
|
+
.options.gmres = (SparseGMRESOptions) {}
|
|
422
|
+
};
|
|
423
|
+
return result;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
427
|
+
SparseIterativeMethod SparseGMRES(SparseGMRESOptions options) {
|
|
428
|
+
SparseIterativeMethod result = {
|
|
429
|
+
.method = _SparseMethodGMRES,
|
|
430
|
+
.options.gmres = options
|
|
431
|
+
};
|
|
432
|
+
return result;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
436
|
+
SparseIterativeMethod SparseLSMR(void) {
|
|
437
|
+
SparseIterativeMethod result = {
|
|
438
|
+
.method = _SparseMethodLSMR,
|
|
439
|
+
.options.lsmr = (SparseLSMROptions) {}
|
|
440
|
+
};
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
static inline SPARSE_PUBLIC_INTERFACE
|
|
445
|
+
SparseIterativeMethod SparseLSMR(SparseLSMROptions options) {
|
|
446
|
+
SparseIterativeMethod result = {
|
|
447
|
+
.method = _SparseMethodLSMR,
|
|
448
|
+
.options.lsmr = options
|
|
449
|
+
};
|
|
450
|
+
return result;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Include type-specifc implementation for double
|
|
454
|
+
#define _SPARSE_IMPLEMENTATION_TYPE double
|
|
455
|
+
#define _SPARSE_OLDSTYLE(NAME) NAME ## _double
|
|
456
|
+
#define _SPARSE_VARIANT(NAME) NAME ## _Double
|
|
457
|
+
#define _SPARSE_REAL_VARIANT(NAME) _SPARSE_VARIANT(NAME)
|
|
458
|
+
#define _SPARSE_REAL_SIZE(NAME) _SPARSE_REAL_VARIANT(NAME)
|
|
459
|
+
#define _SPARSE_IMPLEMENTATION_TYPE_IS_REAL
|
|
460
|
+
#define _SPARSE_ATTRIBUTES SparseAttributes_t
|
|
461
|
+
#include "SolveImplementationTyped.h"
|
|
462
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE
|
|
463
|
+
#undef _SPARSE_VARIANT
|
|
464
|
+
#undef _SPARSE_OLDSTYLE
|
|
465
|
+
#undef _SPARSE_REAL_VARIANT
|
|
466
|
+
#undef _SPARSE_REAL_SIZE
|
|
467
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE_IS_REAL
|
|
468
|
+
#undef _SPARSE_ATTRIBUTES
|
|
469
|
+
|
|
470
|
+
// Include type-specifc implementation for float
|
|
471
|
+
#define _SPARSE_IMPLEMENTATION_TYPE float
|
|
472
|
+
#define _SPARSE_OLDSTYLE(NAME) NAME ## _float
|
|
473
|
+
#define _SPARSE_VARIANT(NAME) NAME ## _Float
|
|
474
|
+
#define _SPARSE_REAL_VARIANT(NAME) _SPARSE_VARIANT(NAME)
|
|
475
|
+
#define _SPARSE_REAL_SIZE(NAME) _SPARSE_REAL_VARIANT(NAME)
|
|
476
|
+
#define _SPARSE_IMPLEMENTATION_TYPE_IS_REAL
|
|
477
|
+
#define _SPARSE_ATTRIBUTES SparseAttributes_t
|
|
478
|
+
#include "SolveImplementationTyped.h"
|
|
479
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE
|
|
480
|
+
#undef _SPARSE_VARIANT
|
|
481
|
+
#undef _SPARSE_OLDSTYLE
|
|
482
|
+
#undef _SPARSE_REAL_VARIANT
|
|
483
|
+
#undef _SPARSE_REAL_SIZE
|
|
484
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE_IS_REAL
|
|
485
|
+
#undef _SPARSE_ATTRIBUTES
|
|
486
|
+
|
|
487
|
+
#if !0
|
|
488
|
+
// Include type-specifc implementation for complex double
|
|
489
|
+
#define _SPARSE_IMPLEMENTATION_TYPE __SPARSE_double_complex
|
|
490
|
+
#define _SPARSE_OLDSTYLE(NAME) NAME ## _double_complex
|
|
491
|
+
#define _SPARSE_VARIANT(NAME) NAME ## _Complex_Double
|
|
492
|
+
#define _SPARSE_REAL_VARIANT(NAME) NAME ## _Double
|
|
493
|
+
#define _SPARSE_REAL_SIZE(NAME) (_SPARSE_REAL_VARIANT(NAME) * 2)
|
|
494
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE_IS_REAL
|
|
495
|
+
#define _SPARSE_ATTRIBUTES SparseAttributesComplex_t
|
|
496
|
+
#include "SolveImplementationTyped.h"
|
|
497
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE
|
|
498
|
+
#undef _SPARSE_VARIANT
|
|
499
|
+
#undef _SPARSE_OLDSTYLE
|
|
500
|
+
#undef _SPARSE_REAL_VARIANT
|
|
501
|
+
#undef _SPARSE_REAL_SIZE
|
|
502
|
+
|
|
503
|
+
// Include type-specifc implementation for complex float
|
|
504
|
+
#define _SPARSE_IMPLEMENTATION_TYPE __SPARSE_float_complex
|
|
505
|
+
#define _SPARSE_OLDSTYLE(NAME) NAME ## _float_complex
|
|
506
|
+
#define _SPARSE_VARIANT(NAME) NAME ## _Complex_Float
|
|
507
|
+
#define _SPARSE_REAL_VARIANT(NAME) NAME ## _Float
|
|
508
|
+
#define _SPARSE_REAL_SIZE(NAME) (_SPARSE_REAL_VARIANT(NAME) * 2)
|
|
509
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE_IS_REAL
|
|
510
|
+
#define _SPARSE_ATTRIBUTES SparseAttributesComplex_t
|
|
511
|
+
#include "SolveImplementationTyped.h"
|
|
512
|
+
#undef _SPARSE_IMPLEMENTATION_TYPE
|
|
513
|
+
#undef _SPARSE_VARIANT
|
|
514
|
+
#undef _SPARSE_OLDSTYLE
|
|
515
|
+
#undef _SPARSE_REAL_VARIANT
|
|
516
|
+
#undef _SPARSE_REAL_SIZE
|
|
517
|
+
#undef _SPARSE_ATTRIBUTES
|
|
518
|
+
#endif // !TARGET_OS_BRIDGE
|
|
519
|
+
|
|
520
|
+
#undef sparse_mul_overflow
|