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,2330 @@
|
|
|
1
|
+
/* Copyright (c) 2014 Apple Inc. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
#ifndef __SPARSE_BLAS_H
|
|
4
|
+
#define __SPARSE_BLAS_H
|
|
5
|
+
|
|
6
|
+
/*!
|
|
7
|
+
@header Sparse/BLAS.h
|
|
8
|
+
@discussion
|
|
9
|
+
|
|
10
|
+
These sparse BLAS routines provide access to sparse computation while hiding
|
|
11
|
+
the details of the sparse matrix storage formats.
|
|
12
|
+
|
|
13
|
+
A brief note on the naming convention used. When an operation has two
|
|
14
|
+
operands, if both operands are sparse then _sparse_ will be in the name, but if
|
|
15
|
+
one operand is sparse and the other dense, then _dense_ will be in the name.
|
|
16
|
+
For example, sparse_inner_product_sparse_float is a sparse-sparse operation and
|
|
17
|
+
sparse_inner_product_dense_float is a sparse-dense operation. Any operation that
|
|
18
|
+
has a single matrix or vector is going to be operating on sparse structures and
|
|
19
|
+
no _dense_ or _sparse_ is added to the name.
|
|
20
|
+
|
|
21
|
+
This sparse BLAS package utilizes a compressed form vector where two storage
|
|
22
|
+
arrays of the same size are used, the first to store the nonzero values of the
|
|
23
|
+
vector, the other to store the index of the nonzero values. For example, for
|
|
24
|
+
the dense vector:
|
|
25
|
+
|
|
26
|
+
d = [3, 0, 0, 7, 9, 0, 4, 0, 0]
|
|
27
|
+
|
|
28
|
+
the sparse vector will be stored as two arrays:
|
|
29
|
+
|
|
30
|
+
s = [3, 7, 9, 4]
|
|
31
|
+
|
|
32
|
+
sindx = [0, 3, 4, 6]
|
|
33
|
+
|
|
34
|
+
These two arrays hold their values as consecutive elements and are referred to
|
|
35
|
+
throughout the documentation as the dense storage of the sparse vector.
|
|
36
|
+
|
|
37
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
38
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
39
|
+
assumptions are not met.
|
|
40
|
+
|
|
41
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
42
|
+
|
|
43
|
+
Due to the variety of sparse matrix representations, the details of the storage
|
|
44
|
+
format are hidden from the developer. There are however two general flavors;
|
|
45
|
+
point wise and block wise storage.
|
|
46
|
+
|
|
47
|
+
With a point wise format, individual elements are stored within the matrix
|
|
48
|
+
representation. Point wise formats allow for adding single (val,i,j) values,
|
|
49
|
+
collections of (val,i,j) values, or sparse vectors as a row or column.
|
|
50
|
+
|
|
51
|
+
With block wise storage formats, blocks of elements are stored within the
|
|
52
|
+
matrix. Block formats allow for adding blocks of values at specified block
|
|
53
|
+
indices. For example if block sizes are constant, adding the K x L block to the
|
|
54
|
+
matrix at block location bi,bj will add values to
|
|
55
|
+
matrix[bi*K:bi*K+K-1,bj*L:bj*L-1]. With block storage formats, block sizes can
|
|
56
|
+
either be uniform throughout the matrix, or variable based on row and column
|
|
57
|
+
location.
|
|
58
|
+
|
|
59
|
+
Beyond selecting a point wise or block wise format, the matrix storage format
|
|
60
|
+
is hidden from the developer.
|
|
61
|
+
|
|
62
|
+
Matrix objects must be memory managed. They are created with a create routine,
|
|
63
|
+
used to completion, and then must be destroyed to release any associated
|
|
64
|
+
memory. The typical work flow is as follows:
|
|
65
|
+
|
|
66
|
+
<pre>
|
|
67
|
+
// Create matrix object and check for error
|
|
68
|
+
sparse_matrix_float A = sparse_matrix_create_float(40,40);
|
|
69
|
+
if ( !A ) { // handle error }
|
|
70
|
+
|
|
71
|
+
// Insert values from existing arrays values, iIndx, and jIndx
|
|
72
|
+
// Then check for error
|
|
73
|
+
if ( sparse_insert_entry_float( A, 12, values, iIndx, jIndx ) ) { // handle error }
|
|
74
|
+
|
|
75
|
+
// Perform computation
|
|
76
|
+
float nrm = sparse_matrix_norm_float( A, SPARSE_NORM_INF );
|
|
77
|
+
|
|
78
|
+
// Clean up
|
|
79
|
+
sparse_matrix_destroy( A );
|
|
80
|
+
</pre>
|
|
81
|
+
|
|
82
|
+
Since data insertion into the internal storage is very expensive, caused by data
|
|
83
|
+
movement and possible memory allocation, data insertion functions do not update
|
|
84
|
+
the internal storage immediately. Rather, all data insertions are put into a pending
|
|
85
|
+
queue. The internal storage is then updated automatically when required by the BLAS
|
|
86
|
+
operations, or explicitly triggered by calling sparse_commit().
|
|
87
|
+
|
|
88
|
+
When commit is triggered automatically by the BLAS operation, expect the operation
|
|
89
|
+
to take longer time. If this is undesirable, consider calling sparse_commit() in a
|
|
90
|
+
less time-sensitive code segment.
|
|
91
|
+
|
|
92
|
+
@copyright Copyright (c) 2015 Apple Inc. All rights reserved.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
#ifdef __cplusplus
|
|
96
|
+
extern "C" {
|
|
97
|
+
#endif
|
|
98
|
+
|
|
99
|
+
#if __has_include(<Accelerate/Accelerate.h>)
|
|
100
|
+
# include <Accelerate/Accelerate.h>
|
|
101
|
+
#else
|
|
102
|
+
# include <cblas.h>
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
#ifndef __SPARSE_TYPES_H
|
|
106
|
+
# include "Types.h"
|
|
107
|
+
#endif
|
|
108
|
+
|
|
109
|
+
#if __has_include(<os/availability.h>)
|
|
110
|
+
# include <os/availability.h>
|
|
111
|
+
#else // __has_include(<os/availability.h>)
|
|
112
|
+
# undef API_AVAILABLE
|
|
113
|
+
# define API_AVAILABLE(...) /* Nothing */
|
|
114
|
+
#endif
|
|
115
|
+
|
|
116
|
+
#pragma mark - Level 1 Routines -
|
|
117
|
+
|
|
118
|
+
/* Level 1 Computational Routines */
|
|
119
|
+
/*!
|
|
120
|
+
@functiongroup Level 1
|
|
121
|
+
@abstract Level 1 routines consisting of vector-vector operations
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/*!
|
|
125
|
+
@abstract
|
|
126
|
+
Compute the inner product of sparse vector x with dense vector y.
|
|
127
|
+
|
|
128
|
+
@param nz
|
|
129
|
+
The number of nonzero entries in the sparse vector x.
|
|
130
|
+
|
|
131
|
+
@param x
|
|
132
|
+
Pointer to the dense storage for the values of the sparse vector x. The
|
|
133
|
+
corresponding entry in indx holds the index of the value. Contains nz values.
|
|
134
|
+
|
|
135
|
+
@param indx
|
|
136
|
+
Pointer to the dense storage for the index values of the sparse vector x. The
|
|
137
|
+
corresponding entry in x holds the values of the vector. Contains nz values.
|
|
138
|
+
|
|
139
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
140
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
141
|
+
assumptions are not met.
|
|
142
|
+
|
|
143
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
144
|
+
|
|
145
|
+
@param y
|
|
146
|
+
Pointer to the dense vector y. Accessed as y[indx[0..nz-1]*incy], so dimension
|
|
147
|
+
must be compatible with largest index value in indx. Behavior undefined if
|
|
148
|
+
this is not met. Negative strides are supported. Note, unlike dense BLAS
|
|
149
|
+
routines, the pointer points to the last element when stride is negative.
|
|
150
|
+
|
|
151
|
+
@param incy
|
|
152
|
+
Increment between valid values in the dense vector y. Negative strides are
|
|
153
|
+
supported.
|
|
154
|
+
|
|
155
|
+
@result
|
|
156
|
+
On exit the result of the inner product is returned.
|
|
157
|
+
|
|
158
|
+
@discussion
|
|
159
|
+
Compute the inner product of sparse vector x with dense vector y. Returns zero
|
|
160
|
+
if nz is less than or equal to zero.
|
|
161
|
+
|
|
162
|
+
*/
|
|
163
|
+
float sparse_inner_product_dense_float( sparse_dimension nz,
|
|
164
|
+
const float * __restrict x,
|
|
165
|
+
const sparse_index * __restrict indx,
|
|
166
|
+
const float * __restrict y,
|
|
167
|
+
sparse_stride incy )
|
|
168
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
169
|
+
|
|
170
|
+
double sparse_inner_product_dense_double( sparse_dimension nz,
|
|
171
|
+
const double * __restrict x,
|
|
172
|
+
const sparse_index * __restrict indx,
|
|
173
|
+
const double * __restrict y,
|
|
174
|
+
sparse_stride incy )
|
|
175
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
176
|
+
|
|
177
|
+
float _Complex sparse_inner_product_dense_float_complex( sparse_dimension nz,
|
|
178
|
+
const float _Complex * __restrict x,
|
|
179
|
+
const sparse_index * __restrict indx,
|
|
180
|
+
const float _Complex * __restrict y,
|
|
181
|
+
sparse_stride incy )
|
|
182
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
183
|
+
|
|
184
|
+
double _Complex sparse_inner_product_dense_double_complex( sparse_dimension nz,
|
|
185
|
+
const double _Complex * __restrict x,
|
|
186
|
+
const sparse_index * __restrict indx,
|
|
187
|
+
const double _Complex * __restrict y,
|
|
188
|
+
sparse_stride incy )
|
|
189
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
/*!
|
|
193
|
+
@abstract
|
|
194
|
+
Compute the inner product of sparse vector x with sparse vector y.
|
|
195
|
+
|
|
196
|
+
@param nzx
|
|
197
|
+
The number of nonzero entries in the sparse vector x.
|
|
198
|
+
|
|
199
|
+
@param nzy
|
|
200
|
+
The number of nonzero entries in the sparse vector y.
|
|
201
|
+
|
|
202
|
+
@param x
|
|
203
|
+
Pointer to the dense storage for the values of the sparse vector x. The
|
|
204
|
+
corresponding entry in indx holds the index of the value. Contains nzx values.
|
|
205
|
+
|
|
206
|
+
@param indx
|
|
207
|
+
Pointer to the dense storage for the index values of the sparse vector x. The
|
|
208
|
+
corresponding entry in x holds the values of the vector. Contains nzx values.
|
|
209
|
+
|
|
210
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
211
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
212
|
+
assumptions are not met.
|
|
213
|
+
|
|
214
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
215
|
+
|
|
216
|
+
@param y
|
|
217
|
+
Pointer to the dense storage for the values of the sparse vector y. The
|
|
218
|
+
corresponding entry in indy holds the index of the value. Contains nzy values.
|
|
219
|
+
|
|
220
|
+
@param indy
|
|
221
|
+
Pointer to the dense storage for the index values of the sparse vector y. The
|
|
222
|
+
corresponding entry in y holds the values of the vector. Contains nzy values.
|
|
223
|
+
|
|
224
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
225
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
226
|
+
assumptions are not met.
|
|
227
|
+
|
|
228
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
229
|
+
|
|
230
|
+
@result
|
|
231
|
+
On exit the result of the inner product is returned.
|
|
232
|
+
|
|
233
|
+
@discussion
|
|
234
|
+
Compute the inner product of sparse vector x with sparse vector y. Returns
|
|
235
|
+
zero if nzx or nzy is less than or equal to zero.
|
|
236
|
+
|
|
237
|
+
*/
|
|
238
|
+
float sparse_inner_product_sparse_float( sparse_dimension nzx, sparse_dimension nzy,
|
|
239
|
+
const float * __restrict x,
|
|
240
|
+
const sparse_index * __restrict indx,
|
|
241
|
+
const float * __restrict y,
|
|
242
|
+
const sparse_index * __restrict indy )
|
|
243
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
244
|
+
|
|
245
|
+
double sparse_inner_product_sparse_double( sparse_dimension nzx, sparse_dimension nzy,
|
|
246
|
+
const double * __restrict x,
|
|
247
|
+
const sparse_index * __restrict indx,
|
|
248
|
+
const double * __restrict y,
|
|
249
|
+
const sparse_index * __restrict indy )
|
|
250
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
251
|
+
|
|
252
|
+
float _Complex sparse_inner_product_sparse_float_complex( sparse_dimension nzx, sparse_dimension nzy,
|
|
253
|
+
const float _Complex * __restrict x,
|
|
254
|
+
const sparse_index * __restrict indx,
|
|
255
|
+
const float _Complex * __restrict y,
|
|
256
|
+
const sparse_index * __restrict indy )
|
|
257
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
258
|
+
|
|
259
|
+
double _Complex sparse_inner_product_sparse_double_complex( sparse_dimension nzx, sparse_dimension nzy,
|
|
260
|
+
const double _Complex * __restrict x,
|
|
261
|
+
const sparse_index * __restrict indx,
|
|
262
|
+
const double _Complex * __restrict y,
|
|
263
|
+
const sparse_index * __restrict indy )
|
|
264
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
265
|
+
|
|
266
|
+
/*!
|
|
267
|
+
@abstract
|
|
268
|
+
Scales the sparse vector x by alpha and adds the result to the dense vector y.
|
|
269
|
+
|
|
270
|
+
y = alpha * x + y
|
|
271
|
+
|
|
272
|
+
@param nz
|
|
273
|
+
The number of nonzero entries in the sparse vector x.
|
|
274
|
+
|
|
275
|
+
@param alpha
|
|
276
|
+
Scalar multiplier of x.
|
|
277
|
+
|
|
278
|
+
@param x
|
|
279
|
+
Pointer to the dense storage for the values of the sparse vector x. The
|
|
280
|
+
corresponding entry in indx holds the index of the value. Contains nz values.
|
|
281
|
+
|
|
282
|
+
@param indx
|
|
283
|
+
Pointer to the dense storage for the index values of the sparse vector x. The
|
|
284
|
+
corresponding entry in x holds the values of the vector. Contains nz values.
|
|
285
|
+
|
|
286
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
287
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
288
|
+
assumptions are not met.
|
|
289
|
+
|
|
290
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
291
|
+
|
|
292
|
+
@param y
|
|
293
|
+
Pointer to the dense vector y. Accessed as y[indx[0..nz-1]*incy], so dimension
|
|
294
|
+
must be compatible with largest index value in indx. Behavior undefined if
|
|
295
|
+
this is not met. Negative strides are supported. Note, unlike dense BLAS
|
|
296
|
+
routines, the pointer points to the last element when stride is negative.
|
|
297
|
+
|
|
298
|
+
@param incy
|
|
299
|
+
Increment between valid values in the dense vector y. Negative strides are
|
|
300
|
+
supported.
|
|
301
|
+
|
|
302
|
+
@result
|
|
303
|
+
On exit y has been updated as y = alpha * x + y. If nz is less than or
|
|
304
|
+
equal to zero or alpha is equal to zero, y is unchanged.
|
|
305
|
+
|
|
306
|
+
@discussion
|
|
307
|
+
Scales the sparse vector x by alpha and adds the result to the dense vector y.
|
|
308
|
+
If alpha or nz is zero, y is unchanged.
|
|
309
|
+
|
|
310
|
+
If the desired operation is y = alpha * x, then an efficient option is to
|
|
311
|
+
create the y buffer of zeros as y = calloc(sizeof(..)*ySize) and then perform
|
|
312
|
+
the operation with the zero filled y.
|
|
313
|
+
*/
|
|
314
|
+
void sparse_vector_add_with_scale_dense_float( sparse_dimension nz, float alpha,
|
|
315
|
+
const float * __restrict x,
|
|
316
|
+
const sparse_index * __restrict indx,
|
|
317
|
+
float * __restrict y,
|
|
318
|
+
sparse_stride incy )
|
|
319
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
320
|
+
|
|
321
|
+
void sparse_vector_add_with_scale_dense_double( sparse_dimension nz, double alpha,
|
|
322
|
+
const double * __restrict x,
|
|
323
|
+
const sparse_index * __restrict indx,
|
|
324
|
+
double * __restrict y,
|
|
325
|
+
sparse_stride incy )
|
|
326
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
327
|
+
|
|
328
|
+
void sparse_vector_add_with_scale_dense_float_complex( sparse_dimension nz, float _Complex alpha,
|
|
329
|
+
const float _Complex * __restrict x,
|
|
330
|
+
const sparse_index * __restrict indx,
|
|
331
|
+
float _Complex * __restrict y,
|
|
332
|
+
sparse_stride incy )
|
|
333
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
334
|
+
|
|
335
|
+
void sparse_vector_add_with_scale_dense_double_complex( sparse_dimension nz, double _Complex alpha,
|
|
336
|
+
const double _Complex * __restrict x,
|
|
337
|
+
const sparse_index * __restrict indx,
|
|
338
|
+
double _Complex * __restrict y,
|
|
339
|
+
sparse_stride incy )
|
|
340
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
341
|
+
|
|
342
|
+
/*!
|
|
343
|
+
@abstract
|
|
344
|
+
Compute the specified norm of the sparse vector x.
|
|
345
|
+
|
|
346
|
+
@param nz
|
|
347
|
+
The number of nonzero values in the sparse vector x.
|
|
348
|
+
|
|
349
|
+
@param x
|
|
350
|
+
Pointer to the dense storage for the values of the sparse vector x. The
|
|
351
|
+
corresponding entry in indx holds the index of the value. Contains nz values.
|
|
352
|
+
|
|
353
|
+
@param indx
|
|
354
|
+
Pointer to the dense storage for the index values of the sparse vector x. The
|
|
355
|
+
corresponding entry in x holds the values of the vector. Contains nz values.
|
|
356
|
+
|
|
357
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
358
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
359
|
+
assumptions are not met.
|
|
360
|
+
|
|
361
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
362
|
+
|
|
363
|
+
@param norm
|
|
364
|
+
Specify the norm to be computed. Must be one of SPARSE_NORM_ONE, SPARSE_NORM_TWO,
|
|
365
|
+
or SPARSE_NORM_INF. See discussion for further details.
|
|
366
|
+
|
|
367
|
+
@result
|
|
368
|
+
Upon success, return the requested norm.
|
|
369
|
+
|
|
370
|
+
@discussion
|
|
371
|
+
Compute the specified norm of the sparse vector x. Specify one of:
|
|
372
|
+
1) SPARSE_NORM_ONE : sum over i ( | x[i] | )
|
|
373
|
+
2) SPARSE_NORM_TWO : sqrt( sum over i (x[i])^2 )
|
|
374
|
+
3) SPARSE_NORM_INF : max over i ( | x[i] | )
|
|
375
|
+
4) SPARSE_NORM_R1 : Not supported, undefined.
|
|
376
|
+
|
|
377
|
+
If norm is not one of the enumerated norm types, the default value is
|
|
378
|
+
SPARSE_NORM_INF.
|
|
379
|
+
|
|
380
|
+
*/
|
|
381
|
+
float sparse_vector_norm_float( sparse_dimension nz, const float * __restrict x,
|
|
382
|
+
const sparse_index * __restrict indx, sparse_norm norm )
|
|
383
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
384
|
+
|
|
385
|
+
double sparse_vector_norm_double( sparse_dimension nz, const double * __restrict x,
|
|
386
|
+
const sparse_index * __restrict indx, sparse_norm norm )
|
|
387
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
388
|
+
|
|
389
|
+
float sparse_vector_norm_float_complex( sparse_dimension nz, const float _Complex * __restrict x,
|
|
390
|
+
const sparse_index * __restrict indx, sparse_norm norm )
|
|
391
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
392
|
+
|
|
393
|
+
double sparse_vector_norm_double_complex( sparse_dimension nz, const double _Complex * __restrict x,
|
|
394
|
+
const sparse_index * __restrict indx, sparse_norm norm )
|
|
395
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
#pragma mark - Level 2 Routines -
|
|
399
|
+
|
|
400
|
+
/* Level 2 Computational Routines */
|
|
401
|
+
/*!
|
|
402
|
+
@functiongroup Level 2
|
|
403
|
+
@abstract Level 2 routines consisting of matrix-vector operations
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
/*!
|
|
407
|
+
@abstract
|
|
408
|
+
Multiplies the dense vector x by the sparse matrix A and adds the result to
|
|
409
|
+
the dense vector y.
|
|
410
|
+
|
|
411
|
+
y = alpha * op(A) * x + y; where op(A) is either A or the transpose of A
|
|
412
|
+
|
|
413
|
+
@param transa
|
|
414
|
+
Specifies whether to perform the operation with A or the transpose of A.
|
|
415
|
+
Must be one of CblasNoTrans or CblasTrans.
|
|
416
|
+
|
|
417
|
+
@param alpha
|
|
418
|
+
Scalar multiplier of A.
|
|
419
|
+
|
|
420
|
+
@param A
|
|
421
|
+
The sparse matrix.
|
|
422
|
+
|
|
423
|
+
@param x
|
|
424
|
+
Pointer to the dense vector x. The dimension must be the number of columns of
|
|
425
|
+
the matrix A when transa is no transpose or the number of rows of the matrix A
|
|
426
|
+
when transa is transpose. Behavior undefined if this is not met. Negative
|
|
427
|
+
strides are supported. Note, unlike dense BLAS routines, the pointer points to
|
|
428
|
+
the last element when stride is negative.
|
|
429
|
+
|
|
430
|
+
@param incx
|
|
431
|
+
Increment between valid values in the dense vector x. Negative strides are
|
|
432
|
+
supported.
|
|
433
|
+
|
|
434
|
+
@param y
|
|
435
|
+
Pointer to the dense vector y. The dimension must be the number of rows of
|
|
436
|
+
the matrix A when transa is no transpose or the number of columns of the matrix
|
|
437
|
+
A when transa is transpose. Behavior undefined if this is not met. Negative
|
|
438
|
+
strides are supported. Note, unlike dense BLAS routines, the pointer points to
|
|
439
|
+
the last element when stride is negative.
|
|
440
|
+
|
|
441
|
+
@param incy
|
|
442
|
+
Increment between valid values in the dense vector y. Negative strides are
|
|
443
|
+
supported.
|
|
444
|
+
|
|
445
|
+
@result
|
|
446
|
+
On success return SPARSE_SUCCESS and y has been updated with result of the
|
|
447
|
+
operation. Will return SPARSE_ILLEGAL_PARAMETER if transa is invalid and y will
|
|
448
|
+
be unchanged.
|
|
449
|
+
|
|
450
|
+
@discussion
|
|
451
|
+
Multiplies the dense vector x by the sparse matrix A and adds the result to
|
|
452
|
+
the dense vector y (y = alpha * op(A) * x + y, where op(A) is either A
|
|
453
|
+
or the transpose of A).
|
|
454
|
+
|
|
455
|
+
If the desired operation is y = A * x, then an efficient option is to create
|
|
456
|
+
the y buffer of zeros as y = calloc(sizeof(..)*ySize) and then perform
|
|
457
|
+
the operation with the zero filled y.
|
|
458
|
+
*/
|
|
459
|
+
sparse_status sparse_matrix_vector_product_dense_float( enum CBLAS_TRANSPOSE transa,
|
|
460
|
+
float alpha,
|
|
461
|
+
sparse_matrix_float A,
|
|
462
|
+
const float * __restrict x,
|
|
463
|
+
sparse_stride incx,
|
|
464
|
+
float * __restrict y,
|
|
465
|
+
sparse_stride incy )
|
|
466
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
467
|
+
|
|
468
|
+
sparse_status sparse_matrix_vector_product_dense_double( enum CBLAS_TRANSPOSE transa,
|
|
469
|
+
double alpha,
|
|
470
|
+
sparse_matrix_double A,
|
|
471
|
+
const double * __restrict x,
|
|
472
|
+
sparse_stride incx,
|
|
473
|
+
double * __restrict y,
|
|
474
|
+
sparse_stride incy )
|
|
475
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
476
|
+
|
|
477
|
+
sparse_status sparse_matrix_vector_product_dense_float_complex( enum CBLAS_TRANSPOSE transa,
|
|
478
|
+
float _Complex alpha,
|
|
479
|
+
sparse_matrix_float_complex A,
|
|
480
|
+
const float _Complex * __restrict x,
|
|
481
|
+
sparse_stride incx,
|
|
482
|
+
float _Complex * __restrict y,
|
|
483
|
+
sparse_stride incy )
|
|
484
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
485
|
+
|
|
486
|
+
sparse_status sparse_matrix_vector_product_dense_double_complex( enum CBLAS_TRANSPOSE transa,
|
|
487
|
+
double _Complex alpha,
|
|
488
|
+
sparse_matrix_double_complex A,
|
|
489
|
+
const double _Complex * __restrict x,
|
|
490
|
+
sparse_stride incx,
|
|
491
|
+
double _Complex * __restrict y,
|
|
492
|
+
sparse_stride incy )
|
|
493
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
494
|
+
|
|
495
|
+
/*!
|
|
496
|
+
@abstract
|
|
497
|
+
Solve the system of equations x = alpha * T^{-1} * x for x where x is a dense
|
|
498
|
+
vector and T is a triangular sparse matrix.
|
|
499
|
+
|
|
500
|
+
@param transt
|
|
501
|
+
Specifies whether to perform the operation with T or the transpose of T.
|
|
502
|
+
Must be one of CblasNoTrans or CblasTrans.
|
|
503
|
+
|
|
504
|
+
@param alpha
|
|
505
|
+
Scalar multiplier of T.
|
|
506
|
+
|
|
507
|
+
@param T
|
|
508
|
+
The sparse triangular matrix. Must be upper or lower triangular matrix.
|
|
509
|
+
Will return SPARSE_ILLEGAL_PARAMETER if not a triangular matrix.
|
|
510
|
+
|
|
511
|
+
@param x
|
|
512
|
+
Pointer to the dense vector x. The dimension must match the dimension of the
|
|
513
|
+
triangular matrix T. Behavior undefined if this is not met. Negative
|
|
514
|
+
strides are supported. Note, unlike dense BLAS routines, the pointer points to
|
|
515
|
+
the last element when stride is negative. On exit holds the solution to the
|
|
516
|
+
system of equations.
|
|
517
|
+
|
|
518
|
+
@param incx
|
|
519
|
+
Increment between valid values in the dense vector x. Negative strides are
|
|
520
|
+
supported.
|
|
521
|
+
|
|
522
|
+
@result
|
|
523
|
+
On success, SPARSE_SUCCESS is returned and x has been updated with result of the
|
|
524
|
+
operation. Will return SPARSE_ILLEGAL_PARAMETER if transt is invalid or if the
|
|
525
|
+
matrix T is not triangular and x will be unchanged.
|
|
526
|
+
|
|
527
|
+
@discussion
|
|
528
|
+
Solve the system of equations x = alpha * T^{-1} * x for x where x is a dense
|
|
529
|
+
vector and T is a triangular sparse matrix. The matrix T must be an upper or
|
|
530
|
+
lower triangular matrix.
|
|
531
|
+
|
|
532
|
+
*/
|
|
533
|
+
sparse_status sparse_vector_triangular_solve_dense_float( enum CBLAS_TRANSPOSE transt,
|
|
534
|
+
float alpha, sparse_matrix_float T,
|
|
535
|
+
float * __restrict x,
|
|
536
|
+
sparse_stride incx )
|
|
537
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
538
|
+
|
|
539
|
+
sparse_status sparse_vector_triangular_solve_dense_double( enum CBLAS_TRANSPOSE transt,
|
|
540
|
+
double alpha,
|
|
541
|
+
sparse_matrix_double T,
|
|
542
|
+
double * __restrict x,
|
|
543
|
+
sparse_stride incx )
|
|
544
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
545
|
+
|
|
546
|
+
sparse_status sparse_vector_triangular_solve_dense_float_complex( enum CBLAS_TRANSPOSE transt,
|
|
547
|
+
float _Complex alpha, sparse_matrix_float_complex T,
|
|
548
|
+
float _Complex * __restrict x,
|
|
549
|
+
sparse_stride incx )
|
|
550
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
551
|
+
|
|
552
|
+
sparse_status sparse_vector_triangular_solve_dense_double_complex( enum CBLAS_TRANSPOSE transt,
|
|
553
|
+
double _Complex alpha,
|
|
554
|
+
sparse_matrix_double_complex T,
|
|
555
|
+
double _Complex * __restrict x,
|
|
556
|
+
sparse_stride incx )
|
|
557
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
558
|
+
|
|
559
|
+
/*!
|
|
560
|
+
@abstract
|
|
561
|
+
Compute the outer product of the dense vector x and the sparse vector y and
|
|
562
|
+
return a new sparse matrix in the uninitialized pointer sparse matrix pointer
|
|
563
|
+
C. C = alpha * x * y'
|
|
564
|
+
|
|
565
|
+
@param M
|
|
566
|
+
The number of rows of x and the resulting matrix.
|
|
567
|
+
|
|
568
|
+
@param N
|
|
569
|
+
The number of columns of the resulting matrix. The number of nonzero values
|
|
570
|
+
must be less than or equal to N.
|
|
571
|
+
|
|
572
|
+
@param nz
|
|
573
|
+
The number of nonzero values in the sparse vector y. Must be less than or
|
|
574
|
+
equal to N.
|
|
575
|
+
|
|
576
|
+
@param alpha
|
|
577
|
+
Scalar multiplier of x.
|
|
578
|
+
|
|
579
|
+
@param x
|
|
580
|
+
Pointer to the dense vector x. Must be M number of elements. Negative strides
|
|
581
|
+
are supported. Note, unlike dense BLAS routines, the pointer points to the
|
|
582
|
+
last element when stride is negative.
|
|
583
|
+
|
|
584
|
+
@param incx
|
|
585
|
+
Increment between valid values in the dense vector x. Negative strides are
|
|
586
|
+
supported.
|
|
587
|
+
|
|
588
|
+
@param y
|
|
589
|
+
Pointer to the dense storage for the values of the sparse vector y. The
|
|
590
|
+
corresponding entry in indy holds the index of the value. Contains nz values.
|
|
591
|
+
|
|
592
|
+
@param indy
|
|
593
|
+
Pointer to the dense storage for the index values of the sparse vector y. The
|
|
594
|
+
corresponding entry in y holds the values of the vector. Contains nz values.
|
|
595
|
+
|
|
596
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
597
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
598
|
+
assumptions are not met.
|
|
599
|
+
|
|
600
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
601
|
+
|
|
602
|
+
@param C
|
|
603
|
+
Pointer to an uninitialized sparse matrix object. On success a newly allocated
|
|
604
|
+
sparse matrix object is returned in this pointer. On error, this set to NULL.
|
|
605
|
+
Caller is responsible for calling sparse_matrix_destroy on this matrix object.
|
|
606
|
+
|
|
607
|
+
@result
|
|
608
|
+
On success SPARSE_SUCCESS is returned an C is valid matrix object. The caller is
|
|
609
|
+
responsible for cleaning up the sparse matrix object with sparse_matrix_destroy.
|
|
610
|
+
Will return SPARSE_ILLEGAL_PARAMETER if nz > N, and C will be unchanged.
|
|
611
|
+
|
|
612
|
+
@discussion
|
|
613
|
+
Compute the outer product of the dense vector x and the sparse vector y and
|
|
614
|
+
return a new sparse matrix in the uninitialized pointer sparse matrix pointer
|
|
615
|
+
C. C = alpha * x * y'. Caller responsible for calling sparse_matrix_destroy on
|
|
616
|
+
the returned matrix.
|
|
617
|
+
|
|
618
|
+
The matrix object returned on success is a point wise based sparse matrix.
|
|
619
|
+
|
|
620
|
+
*/
|
|
621
|
+
sparse_status sparse_outer_product_dense_float( sparse_dimension M, sparse_dimension N,
|
|
622
|
+
sparse_dimension nz, float alpha,
|
|
623
|
+
const float * __restrict x, sparse_stride incx,
|
|
624
|
+
const float * __restrict y,
|
|
625
|
+
const sparse_index * __restrict indy,
|
|
626
|
+
sparse_matrix_float * __restrict C)
|
|
627
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
628
|
+
|
|
629
|
+
sparse_status sparse_outer_product_dense_double( sparse_dimension M, sparse_dimension N,
|
|
630
|
+
sparse_dimension nz, double alpha,
|
|
631
|
+
const double * __restrict x,
|
|
632
|
+
sparse_stride incx, const double * __restrict y,
|
|
633
|
+
const sparse_index * __restrict indy,
|
|
634
|
+
sparse_matrix_double * __restrict C)
|
|
635
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
636
|
+
|
|
637
|
+
sparse_status sparse_outer_product_dense_float_complex( sparse_dimension M, sparse_dimension N,
|
|
638
|
+
sparse_dimension nz, float _Complex alpha,
|
|
639
|
+
const float _Complex * __restrict x, sparse_stride incx,
|
|
640
|
+
const float _Complex * __restrict y,
|
|
641
|
+
const sparse_index * __restrict indy,
|
|
642
|
+
sparse_matrix_float_complex * __restrict C)
|
|
643
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
644
|
+
|
|
645
|
+
sparse_status sparse_outer_product_dense_double_complex( sparse_dimension M, sparse_dimension N,
|
|
646
|
+
sparse_dimension nz, double _Complex alpha,
|
|
647
|
+
const double _Complex * __restrict x,
|
|
648
|
+
sparse_stride incx, const double _Complex * __restrict y,
|
|
649
|
+
const sparse_index * __restrict indy,
|
|
650
|
+
sparse_matrix_double_complex * __restrict C)
|
|
651
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
652
|
+
|
|
653
|
+
/*!
|
|
654
|
+
@abstract
|
|
655
|
+
Permute the rows of the sparse matrix A based on the provided permutation
|
|
656
|
+
array.
|
|
657
|
+
|
|
658
|
+
@param A
|
|
659
|
+
The sparse matrix.
|
|
660
|
+
|
|
661
|
+
@param perm
|
|
662
|
+
The permutation array. Holds number of rows in A values indicating the
|
|
663
|
+
permutation of the matrix. The indices in perm are expected to be 0 based
|
|
664
|
+
(first element of pointer is ptr[0]). The indices in perm are expected to
|
|
665
|
+
be within bounds of the matrix. Undefined behavior if not met.
|
|
666
|
+
|
|
667
|
+
@result
|
|
668
|
+
On successful return, A has been permuted and SPARSE_SUCCESS is returned.
|
|
669
|
+
|
|
670
|
+
@discussion
|
|
671
|
+
Permute the rows of the sparse matrix A based on the provided permutation
|
|
672
|
+
array. For each row in A, swap rows as:
|
|
673
|
+
|
|
674
|
+
tmp[:] = A[i,:];
|
|
675
|
+
A[i,:] = A[perm[i],:];
|
|
676
|
+
A[perm[i],:] = tmp[:];
|
|
677
|
+
|
|
678
|
+
*/
|
|
679
|
+
sparse_status sparse_permute_rows_float( sparse_matrix_float A,
|
|
680
|
+
const sparse_index * __restrict perm )
|
|
681
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
682
|
+
|
|
683
|
+
sparse_status sparse_permute_rows_double( sparse_matrix_double A,
|
|
684
|
+
const sparse_index * __restrict perm )
|
|
685
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
686
|
+
|
|
687
|
+
sparse_status sparse_permute_rows_float_complex( sparse_matrix_float_complex A,
|
|
688
|
+
const sparse_index * __restrict perm )
|
|
689
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
690
|
+
|
|
691
|
+
sparse_status sparse_permute_rows_double_complex( sparse_matrix_double_complex A,
|
|
692
|
+
const sparse_index * __restrict perm )
|
|
693
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
694
|
+
|
|
695
|
+
/*!
|
|
696
|
+
@abstract
|
|
697
|
+
Permute the columns of the sparse matrix A based on the provided permutation
|
|
698
|
+
array.
|
|
699
|
+
|
|
700
|
+
@param A
|
|
701
|
+
The sparse matrix.
|
|
702
|
+
|
|
703
|
+
@param perm
|
|
704
|
+
The permutation array. Holds number of columns in A values indicating the
|
|
705
|
+
permutation of the matrix. The indices in perm are expected to be 0 based
|
|
706
|
+
(first element of pointer is ptr[0]). The indices in perm are expected to
|
|
707
|
+
be within bounds of the matrix. Undefined behavior if not met.
|
|
708
|
+
|
|
709
|
+
@result
|
|
710
|
+
On successful return, A has been permuted and SPARSE_SUCCESS is returned.
|
|
711
|
+
|
|
712
|
+
@discussion
|
|
713
|
+
Permute the columns of the sparse matrix A based on the provided permutation
|
|
714
|
+
array. For each column in A, swap columns as:
|
|
715
|
+
|
|
716
|
+
tmp[:] = A[:,j];
|
|
717
|
+
A[:,j] = A[:,perm[j]];
|
|
718
|
+
A[:,perm[j]] = tmp[:];
|
|
719
|
+
|
|
720
|
+
*/
|
|
721
|
+
sparse_status sparse_permute_cols_float( sparse_matrix_float A,
|
|
722
|
+
const sparse_index * __restrict perm )
|
|
723
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
724
|
+
|
|
725
|
+
sparse_status sparse_permute_cols_double( sparse_matrix_double A,
|
|
726
|
+
const sparse_index * __restrict perm )
|
|
727
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
728
|
+
|
|
729
|
+
sparse_status sparse_permute_cols_float_complex( sparse_matrix_float_complex A,
|
|
730
|
+
const sparse_index * __restrict perm )
|
|
731
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
732
|
+
|
|
733
|
+
sparse_status sparse_permute_cols_double_complex( sparse_matrix_double_complex A,
|
|
734
|
+
const sparse_index * __restrict perm )
|
|
735
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
736
|
+
|
|
737
|
+
/*!
|
|
738
|
+
@abstract
|
|
739
|
+
Compute the specified elementwise norm of the sparse matrix A. This is the
|
|
740
|
+
norm of the matrix treated as a vector, not the operator norm.
|
|
741
|
+
|
|
742
|
+
@param A
|
|
743
|
+
The sparse matrix.
|
|
744
|
+
|
|
745
|
+
@param norm
|
|
746
|
+
Specify the norm to be computed. Must be one of SPARSE_NORM_ONE, SPARSE_NORM_TWO,
|
|
747
|
+
SPARSE_NORM_INF, or SPARSE_NORM_R1. See discussion for further details.
|
|
748
|
+
|
|
749
|
+
@result
|
|
750
|
+
Upon success, resulting norm is returned.
|
|
751
|
+
|
|
752
|
+
@discussion
|
|
753
|
+
Compute the specified norm of the sparse matrix A. This is the norm of the
|
|
754
|
+
matrix treated as a vector, not the operator norm. Specify one of:
|
|
755
|
+
1) SPARSE_NORM_ONE : sum over i,j ( | A[i,j] | )
|
|
756
|
+
2) SPARSE_NORM_TWO : sqrt( sum over i,j (A[i,j])^2 )
|
|
757
|
+
3) SPARSE_NORM_INF : max over i,j ( | A[i,j] | )
|
|
758
|
+
4) SPARSE_NORM_R1 : sum over j ( sqrt ( sum over i ( A[i,j]^2 ) ) )
|
|
759
|
+
|
|
760
|
+
If norm is not one of the enumerated norm types, the default value is
|
|
761
|
+
SPARSE_NORM_INF.
|
|
762
|
+
|
|
763
|
+
*/
|
|
764
|
+
float sparse_elementwise_norm_float( sparse_matrix_float A, sparse_norm norm )
|
|
765
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
766
|
+
|
|
767
|
+
double sparse_elementwise_norm_double( sparse_matrix_double A, sparse_norm norm )
|
|
768
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
769
|
+
|
|
770
|
+
float sparse_elementwise_norm_float_complex( sparse_matrix_float_complex A, sparse_norm norm )
|
|
771
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
772
|
+
|
|
773
|
+
double sparse_elementwise_norm_double_complex( sparse_matrix_double_complex A, sparse_norm norm )
|
|
774
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
775
|
+
|
|
776
|
+
/*!
|
|
777
|
+
@abstract
|
|
778
|
+
Compute the specified operator norm of the sparse matrix A. For elementwise
|
|
779
|
+
norm use elementwise_norm routines.
|
|
780
|
+
|
|
781
|
+
@param A
|
|
782
|
+
The sparse matrix.
|
|
783
|
+
|
|
784
|
+
@param norm
|
|
785
|
+
Specify the norm to be computed. Must be one of SPARSE_NORM_ONE, SPARSE_NORM_TWO,
|
|
786
|
+
or SPARSE_NORM_INF. See discussion for further details.
|
|
787
|
+
|
|
788
|
+
@result
|
|
789
|
+
Upon success, resulting norm is returned.
|
|
790
|
+
|
|
791
|
+
@discussion
|
|
792
|
+
Compute the specified norm of the sparse matrix A. This is the norm of the
|
|
793
|
+
matrix treated as an linear operator, not the elementwise norm. Specify one of:
|
|
794
|
+
1) SPARSE_NORM_ONE : max over j ( sum over i ( | A[i,j] | ) )
|
|
795
|
+
2) SPARSE_NORM_TWO : Maximum singular value. This is significantly more
|
|
796
|
+
expensive to compute than the other norms.
|
|
797
|
+
3) SPARSE_NORM_INF : max over i ( sum over j ( | A[i,j] | ) )
|
|
798
|
+
4) SPARSE_NORM_R1 : Not supported, undefined.
|
|
799
|
+
|
|
800
|
+
If norm is not one of the enumerated norm types, the default value is
|
|
801
|
+
SPARSE_NORM_INF.
|
|
802
|
+
|
|
803
|
+
*/
|
|
804
|
+
float sparse_operator_norm_float( sparse_matrix_float A, sparse_norm norm )
|
|
805
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
806
|
+
|
|
807
|
+
double sparse_operator_norm_double( sparse_matrix_double A, sparse_norm norm )
|
|
808
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
809
|
+
|
|
810
|
+
float sparse_operator_norm_float_complex( sparse_matrix_float_complex A, sparse_norm norm )
|
|
811
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
812
|
+
|
|
813
|
+
double sparse_operator_norm_double_complex( sparse_matrix_double_complex A, sparse_norm norm )
|
|
814
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
815
|
+
|
|
816
|
+
/*!
|
|
817
|
+
@abstract
|
|
818
|
+
Compute the sum along the specified diagonal of the sparse matrix A.
|
|
819
|
+
|
|
820
|
+
@param A
|
|
821
|
+
The sparse matrix.
|
|
822
|
+
|
|
823
|
+
@param offset
|
|
824
|
+
Specifies the diagonal to sum. A zero value will sum the main diagonal
|
|
825
|
+
(A[i,i]), a value greater than zero will sum diagonals above the main diagonal
|
|
826
|
+
(A[i,i+offset]), and a values less than zero will sum diagonals below the main
|
|
827
|
+
diagonal (A[i-offset,i]). If offset is out of the bounds of the matrix A, 0
|
|
828
|
+
is returned.
|
|
829
|
+
|
|
830
|
+
@result
|
|
831
|
+
On success, the resulting trace is returned.
|
|
832
|
+
|
|
833
|
+
@discussion
|
|
834
|
+
Compute the sum along the specified diagonal of the sparse matrix A. The
|
|
835
|
+
diagonal is specified by the parameter offset where zero is the main diagonal,
|
|
836
|
+
values greater than one refer to diagonals above the main diagonal
|
|
837
|
+
(A[i,i+offset]), and values less than one refer to diagonals below the main
|
|
838
|
+
diagonal (A[i-offset, i]).
|
|
839
|
+
|
|
840
|
+
If offset is out of the bounds of the matrix A, 0 is returned.
|
|
841
|
+
|
|
842
|
+
*/
|
|
843
|
+
float sparse_matrix_trace_float( sparse_matrix_float A, sparse_index offset )
|
|
844
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
845
|
+
|
|
846
|
+
double sparse_matrix_trace_double( sparse_matrix_double A, sparse_index offset )
|
|
847
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
848
|
+
|
|
849
|
+
float _Complex sparse_matrix_trace_float_complex( sparse_matrix_float_complex A, sparse_index offset )
|
|
850
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
851
|
+
|
|
852
|
+
double _Complex sparse_matrix_trace_double_complex( sparse_matrix_double_complex A, sparse_index offset )
|
|
853
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
#pragma mark - Level 3 Routines -
|
|
858
|
+
|
|
859
|
+
/* Level 3 Computational Routines */
|
|
860
|
+
/*!
|
|
861
|
+
@functiongroup Level 3
|
|
862
|
+
@abstract Level 3 routines consisting of matrix-matrix operations
|
|
863
|
+
*/
|
|
864
|
+
/*!
|
|
865
|
+
@abstract
|
|
866
|
+
Multiplies the dense matrix B by the sparse matrix A and adds the result to
|
|
867
|
+
the dense matrix C.
|
|
868
|
+
|
|
869
|
+
C = alpha * op(A) * B + C; where op(A) is either A or the transpose of A
|
|
870
|
+
|
|
871
|
+
@param order
|
|
872
|
+
Specified the storage order for the dense matrices B and C. Must be one of
|
|
873
|
+
CblasRowMajor or CblasColMajor.
|
|
874
|
+
|
|
875
|
+
@param transa
|
|
876
|
+
Specifies whether to perform the operation with A or the transpose of A.
|
|
877
|
+
Must be one of CblasNoTrans or CblasTrans.
|
|
878
|
+
|
|
879
|
+
@param n
|
|
880
|
+
The number of columns of the matrices B and C.
|
|
881
|
+
|
|
882
|
+
@param alpha
|
|
883
|
+
Scalar multiplier of A.
|
|
884
|
+
|
|
885
|
+
@param A
|
|
886
|
+
The sparse matrix.
|
|
887
|
+
|
|
888
|
+
@param B
|
|
889
|
+
Pointer to the dense matrix B. The number of rows must be equal to the number
|
|
890
|
+
of columns of A and the number of columns is n. Behavior undefined if this
|
|
891
|
+
is not met. The argument ldb describes how many elements to move between one
|
|
892
|
+
row (row major) or column (column major).
|
|
893
|
+
|
|
894
|
+
@param ldb
|
|
895
|
+
Increment in elements between rows (row major) or columns (column major) of B.
|
|
896
|
+
Must be greater than or equal to n when row major, or number of columns of
|
|
897
|
+
A when column major.
|
|
898
|
+
|
|
899
|
+
@param C
|
|
900
|
+
Pointer to the dense matrix C. The number of rows must be equal to the number
|
|
901
|
+
of rows of A and the number of columns is n. Behavior undefined if this
|
|
902
|
+
is not met. The argument ldc describes how many elements to move between one
|
|
903
|
+
row (row major) or column (column major). C is updated with the result of the
|
|
904
|
+
operation.
|
|
905
|
+
|
|
906
|
+
@param ldc
|
|
907
|
+
Increment in elements between rows (row major) or columns (column major) of C.
|
|
908
|
+
Must be greater than or equal to n when row major, or number of rows of
|
|
909
|
+
A when column major.
|
|
910
|
+
|
|
911
|
+
@result
|
|
912
|
+
On success, SPARSE_SUCCESS is returned and C has been updated with result of the
|
|
913
|
+
operation. Will return SPARSE_ILLEGAL_PARAMETER if order or transa is not valid
|
|
914
|
+
or the leading dimension parameters do not meet their dimension requirements.
|
|
915
|
+
On error, C is unchanged.
|
|
916
|
+
|
|
917
|
+
@discussion
|
|
918
|
+
Multiplies the dense matrix B by the sparse matrix A and adds the result to
|
|
919
|
+
the dense matrix C (C = alpha * op(A) * B + C, where op(A) is either A
|
|
920
|
+
or the transpose of A). If A is of size M x N, then B is of size N x n and C is
|
|
921
|
+
of size M x n.
|
|
922
|
+
|
|
923
|
+
If the desired operation is C = A * B, then an efficient option is to create
|
|
924
|
+
the C buffer of zeros as C = calloc(sizeof(..)*rows*cols) and then perform
|
|
925
|
+
the operation with the zero filled C.
|
|
926
|
+
*/
|
|
927
|
+
sparse_status sparse_matrix_product_dense_float( enum CBLAS_ORDER order,
|
|
928
|
+
enum CBLAS_TRANSPOSE transa,
|
|
929
|
+
sparse_dimension n, float alpha,
|
|
930
|
+
sparse_matrix_float A,
|
|
931
|
+
const float * __restrict B,
|
|
932
|
+
sparse_dimension ldb,
|
|
933
|
+
float * __restrict C,
|
|
934
|
+
sparse_dimension ldc )
|
|
935
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
936
|
+
|
|
937
|
+
sparse_status sparse_matrix_product_dense_double( enum CBLAS_ORDER order,
|
|
938
|
+
enum CBLAS_TRANSPOSE transa,
|
|
939
|
+
sparse_dimension n, double alpha,
|
|
940
|
+
sparse_matrix_double A,
|
|
941
|
+
const double * __restrict B,
|
|
942
|
+
sparse_dimension ldb,
|
|
943
|
+
double * __restrict C,
|
|
944
|
+
sparse_dimension ldc )
|
|
945
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
946
|
+
|
|
947
|
+
sparse_status sparse_matrix_product_dense_float_complex( enum CBLAS_ORDER order,
|
|
948
|
+
enum CBLAS_TRANSPOSE transa,
|
|
949
|
+
sparse_dimension n, float _Complex alpha,
|
|
950
|
+
sparse_matrix_float_complex A,
|
|
951
|
+
const float _Complex * __restrict B,
|
|
952
|
+
sparse_dimension ldb,
|
|
953
|
+
float _Complex * __restrict C,
|
|
954
|
+
sparse_dimension ldc )
|
|
955
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
956
|
+
|
|
957
|
+
sparse_status sparse_matrix_product_dense_double_complex( enum CBLAS_ORDER order,
|
|
958
|
+
enum CBLAS_TRANSPOSE transa,
|
|
959
|
+
sparse_dimension n, double _Complex alpha,
|
|
960
|
+
sparse_matrix_double_complex A,
|
|
961
|
+
const double _Complex * __restrict B,
|
|
962
|
+
sparse_dimension ldb,
|
|
963
|
+
double _Complex * __restrict C,
|
|
964
|
+
sparse_dimension ldc )
|
|
965
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
966
|
+
|
|
967
|
+
/*!
|
|
968
|
+
@abstract
|
|
969
|
+
Multiplies the sparse matrix B by the sparse matrix A and adds the result to
|
|
970
|
+
the dense matrix C.
|
|
971
|
+
|
|
972
|
+
C = alpha * op(A) * B + C; where op(A) is either A or the transpose of A
|
|
973
|
+
|
|
974
|
+
@param order
|
|
975
|
+
Specified the storage order for the dense matrix C. Must be one of
|
|
976
|
+
CblasRowMajor or CblasColMajor.
|
|
977
|
+
|
|
978
|
+
@param transa
|
|
979
|
+
Specifies whether to perform the operation with A or the transpose of A.
|
|
980
|
+
Must be one of CblasNoTrans or CblasTrans.
|
|
981
|
+
|
|
982
|
+
@param alpha
|
|
983
|
+
Scalar multiplier of A.
|
|
984
|
+
|
|
985
|
+
@param A
|
|
986
|
+
The sparse matrix A.
|
|
987
|
+
|
|
988
|
+
@param B
|
|
989
|
+
The sparse matrix B.
|
|
990
|
+
|
|
991
|
+
@param C
|
|
992
|
+
Pointer to the dense matrix C. The number of rows must be equal to the number
|
|
993
|
+
of rows of A and the number of columns must be equal to the number
|
|
994
|
+
of columns of B. Behavior undefined if this is not met.
|
|
995
|
+
The argument ldc describes how many elements to move between one row (row major)
|
|
996
|
+
or column (column major). C is updated with the result of the operation.
|
|
997
|
+
|
|
998
|
+
@param ldc
|
|
999
|
+
Increment in elements between rows (row major) or columns (column major) of C.
|
|
1000
|
+
Must be greater than or equal to the number of columns of B when row major,
|
|
1001
|
+
or number of rows of A when column major.
|
|
1002
|
+
|
|
1003
|
+
@result
|
|
1004
|
+
On success, SPARSE_SUCCESS is returned and C has been updated with result of the
|
|
1005
|
+
operation. Will return SPARSE_ILLEGAL_PARAMETER if order or transa is not valid
|
|
1006
|
+
or the leading dimension parameters do not meet their dimension requirements.
|
|
1007
|
+
On error, C is unchanged.
|
|
1008
|
+
|
|
1009
|
+
@discussion
|
|
1010
|
+
Multiplies the sparse matrix B by the sparse matrix A and adds the result to
|
|
1011
|
+
the dense matrix C (C = alpha * op(A) * B + C, where op(A) is either A
|
|
1012
|
+
or the transpose of A). If A is of size M x K, then B is of size K x N and C is
|
|
1013
|
+
of size M x N.
|
|
1014
|
+
|
|
1015
|
+
If the desired operation is C = A * B, then an efficient option is to create
|
|
1016
|
+
the C buffer of zeros as C = calloc(sizeof(..)*rows*cols) and then perform
|
|
1017
|
+
the operation with the zero filled C.
|
|
1018
|
+
*/
|
|
1019
|
+
sparse_status sparse_matrix_product_sparse_float(enum CBLAS_ORDER order,
|
|
1020
|
+
enum CBLAS_TRANSPOSE transa,
|
|
1021
|
+
float alpha,
|
|
1022
|
+
sparse_matrix_float A,
|
|
1023
|
+
sparse_matrix_float B,
|
|
1024
|
+
float * __restrict C,
|
|
1025
|
+
sparse_dimension ldc )
|
|
1026
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1027
|
+
|
|
1028
|
+
sparse_status sparse_matrix_product_sparse_double(enum CBLAS_ORDER order,
|
|
1029
|
+
enum CBLAS_TRANSPOSE transa,
|
|
1030
|
+
double alpha,
|
|
1031
|
+
sparse_matrix_double A,
|
|
1032
|
+
sparse_matrix_double B,
|
|
1033
|
+
double * __restrict C,
|
|
1034
|
+
sparse_dimension ldc )
|
|
1035
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1036
|
+
|
|
1037
|
+
sparse_status sparse_matrix_product_sparse_float_complex(enum CBLAS_ORDER order,
|
|
1038
|
+
enum CBLAS_TRANSPOSE transa,
|
|
1039
|
+
float _Complex alpha,
|
|
1040
|
+
sparse_matrix_float_complex A,
|
|
1041
|
+
sparse_matrix_float_complex B,
|
|
1042
|
+
float _Complex * __restrict C,
|
|
1043
|
+
sparse_dimension ldc )
|
|
1044
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1045
|
+
|
|
1046
|
+
sparse_status sparse_matrix_product_sparse_double_complex(enum CBLAS_ORDER order,
|
|
1047
|
+
enum CBLAS_TRANSPOSE transa,
|
|
1048
|
+
double _Complex alpha,
|
|
1049
|
+
sparse_matrix_double_complex A,
|
|
1050
|
+
sparse_matrix_double_complex B,
|
|
1051
|
+
double _Complex * __restrict C,
|
|
1052
|
+
sparse_dimension ldc )
|
|
1053
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1054
|
+
|
|
1055
|
+
/*!
|
|
1056
|
+
@abstract
|
|
1057
|
+
Solve the system of equations B = alpha * T^{-1} * B for B where B is a dense
|
|
1058
|
+
matrix and T is a triangular sparse matrix.
|
|
1059
|
+
|
|
1060
|
+
@param order
|
|
1061
|
+
Specified the storage order for the dense matrix B. Must be one of
|
|
1062
|
+
CblasRowMajor or CblasColMajor.
|
|
1063
|
+
|
|
1064
|
+
@param transt
|
|
1065
|
+
Specifies whether to perform the operation with T or the transpose of T.
|
|
1066
|
+
Must be one of CblasNoTrans or CblasTrans.
|
|
1067
|
+
|
|
1068
|
+
@param nrhs
|
|
1069
|
+
The number of columns of the matrix B.
|
|
1070
|
+
|
|
1071
|
+
@param alpha
|
|
1072
|
+
Scalar multiplier of T.
|
|
1073
|
+
|
|
1074
|
+
@param T
|
|
1075
|
+
The sparse triangular matrix. Must be upper or lower triangular matrix.
|
|
1076
|
+
Will return SPARSE_ILLEGAL_PARAMETER if not a triangular matrix.
|
|
1077
|
+
|
|
1078
|
+
@param B
|
|
1079
|
+
Pointer to the dense matrix B. The number of rows must be equal to the number
|
|
1080
|
+
of columns of T and the number of columns is nrhs. Behavior undefined if this
|
|
1081
|
+
is not met. The argument ldb describes how many elements to move between one
|
|
1082
|
+
row (row major) or column (column major). On exit holds the solution to the
|
|
1083
|
+
system of equations.
|
|
1084
|
+
|
|
1085
|
+
@param ldb
|
|
1086
|
+
Increment in elements between rows (row major) or columns (column major) of B.
|
|
1087
|
+
Must be greater than or equal to nrhs when row major, or number of columns of
|
|
1088
|
+
A when column major.
|
|
1089
|
+
|
|
1090
|
+
@result
|
|
1091
|
+
On success, SPARSE_SUCCESS is returned and B has been updated with result of the
|
|
1092
|
+
operation. Will return SPARSE_ILLEGAL_PARAMETER if either of order or trant are
|
|
1093
|
+
invalid or the ldb does not meet its dimension requirements. On error
|
|
1094
|
+
B is unchanged.
|
|
1095
|
+
|
|
1096
|
+
@discussion
|
|
1097
|
+
Solve the system of equations B = alpha * T^{-1} * B for B where B is a dense
|
|
1098
|
+
vector and T is a triangular sparse matrix. If T is of size N x N, then B must
|
|
1099
|
+
be of size N x nrhs. The matrix T must be an upper or lower triangular matrix.
|
|
1100
|
+
|
|
1101
|
+
*/
|
|
1102
|
+
sparse_status sparse_matrix_triangular_solve_dense_float( enum CBLAS_ORDER order,
|
|
1103
|
+
enum CBLAS_TRANSPOSE transt,
|
|
1104
|
+
sparse_dimension nrhs, float alpha,
|
|
1105
|
+
sparse_matrix_float T,
|
|
1106
|
+
float * __restrict B, sparse_dimension ldb )
|
|
1107
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1108
|
+
|
|
1109
|
+
sparse_status sparse_matrix_triangular_solve_dense_double( enum CBLAS_ORDER order,
|
|
1110
|
+
enum CBLAS_TRANSPOSE transt,
|
|
1111
|
+
sparse_dimension nrhs, double alpha,
|
|
1112
|
+
sparse_matrix_double T,
|
|
1113
|
+
double * __restrict B, sparse_dimension ldb )
|
|
1114
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1115
|
+
|
|
1116
|
+
sparse_status sparse_matrix_triangular_solve_dense_float_complex( enum CBLAS_ORDER order,
|
|
1117
|
+
enum CBLAS_TRANSPOSE transt,
|
|
1118
|
+
sparse_dimension nrhs, float _Complex alpha,
|
|
1119
|
+
sparse_matrix_float_complex T,
|
|
1120
|
+
float _Complex * __restrict B, sparse_dimension ldb )
|
|
1121
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1122
|
+
|
|
1123
|
+
sparse_status sparse_matrix_triangular_solve_dense_double_complex( enum CBLAS_ORDER order,
|
|
1124
|
+
enum CBLAS_TRANSPOSE transt,
|
|
1125
|
+
sparse_dimension nrhs, double _Complex alpha,
|
|
1126
|
+
sparse_matrix_double_complex T,
|
|
1127
|
+
double _Complex * __restrict B, sparse_dimension ldb )
|
|
1128
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
#pragma mark - Point Wise Sparse Matrix Routines -
|
|
1132
|
+
|
|
1133
|
+
/* Point Wise Matrix Routines */
|
|
1134
|
+
/*!
|
|
1135
|
+
@functiongroup Point Wise Matrix Routines
|
|
1136
|
+
@abstract Routines to create and insert values in a point wise sparse matrix.
|
|
1137
|
+
*/
|
|
1138
|
+
|
|
1139
|
+
/*!
|
|
1140
|
+
@abstract
|
|
1141
|
+
Create a sparse matrix object that is stored in point wise format and is ready
|
|
1142
|
+
to receive values from the various insert routines.
|
|
1143
|
+
|
|
1144
|
+
@param M
|
|
1145
|
+
The number of rows of the matrix. Must be greater than 0.
|
|
1146
|
+
|
|
1147
|
+
@param N
|
|
1148
|
+
The number of columns of the matrix. Must be greater than 0.
|
|
1149
|
+
|
|
1150
|
+
@result
|
|
1151
|
+
On success, returns a matrix object that is ready for receiving entries. If an
|
|
1152
|
+
error occurs, NULL is returned.
|
|
1153
|
+
|
|
1154
|
+
@discussion
|
|
1155
|
+
Create a sparse matrix object that is stored in point wise format and is ready
|
|
1156
|
+
to receive values from the various insert routines. Point wise format means
|
|
1157
|
+
individual values are stored for a given i,j location as opposed to blocks of
|
|
1158
|
+
values. For block support use the block_create routines. See the various
|
|
1159
|
+
insert routines for details on inserting entries into this matrix object.
|
|
1160
|
+
|
|
1161
|
+
The dimensions M and N must be greater than 0. On success a valid matrix
|
|
1162
|
+
object is returned, otherwise NULL is returned.
|
|
1163
|
+
|
|
1164
|
+
*/
|
|
1165
|
+
sparse_matrix_float sparse_matrix_create_float( sparse_dimension M, sparse_dimension N )
|
|
1166
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1167
|
+
|
|
1168
|
+
sparse_matrix_double sparse_matrix_create_double( sparse_dimension M, sparse_dimension N )
|
|
1169
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1170
|
+
|
|
1171
|
+
sparse_matrix_float_complex sparse_matrix_create_float_complex( sparse_dimension M, sparse_dimension N )
|
|
1172
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1173
|
+
|
|
1174
|
+
sparse_matrix_double_complex sparse_matrix_create_double_complex( sparse_dimension M, sparse_dimension N )
|
|
1175
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1176
|
+
|
|
1177
|
+
/*!
|
|
1178
|
+
@abstract
|
|
1179
|
+
Use to build a sparse matrix by inserting one scalar entry at a time. Update
|
|
1180
|
+
A[i,j] = val. A must have been created with one of sparse_matrix_create_float or
|
|
1181
|
+
sparse_matrix_create_double.
|
|
1182
|
+
|
|
1183
|
+
@param A
|
|
1184
|
+
The sparse matrix. A must have been created with one of sparse_matrix_create_float
|
|
1185
|
+
or sparse_matrix_create_double. SPARSE_ILLEGAL_PARAMETER is returned if not met.
|
|
1186
|
+
|
|
1187
|
+
@param val
|
|
1188
|
+
The scalar value to insert into the sparse matrix.
|
|
1189
|
+
|
|
1190
|
+
@param i
|
|
1191
|
+
The row location to insert the value. Indices are 0 based (first element of
|
|
1192
|
+
pointer is ptr[0]). Indices expected to be in the bounds of matrix dimensions,
|
|
1193
|
+
undefined behavior if not met.
|
|
1194
|
+
|
|
1195
|
+
@param j
|
|
1196
|
+
The column location to insert the value. Indices are 0 based (first element of
|
|
1197
|
+
pointer is ptr[0]). Indices expected to be in the bounds of matrix dimensions,
|
|
1198
|
+
undefined behavior if not met.
|
|
1199
|
+
|
|
1200
|
+
@result
|
|
1201
|
+
On successful insertion, A has been updated with the value and SPARSE_SUCCESS is
|
|
1202
|
+
returned. If A creation requirements are not met, SPARSE_ILLEGAL_PARAMETER is
|
|
1203
|
+
returned and A is unchanged.
|
|
1204
|
+
|
|
1205
|
+
@discussion
|
|
1206
|
+
Use to build a sparse matrix by inserting one scalar entry at a time. Update
|
|
1207
|
+
A[i,j] = val.
|
|
1208
|
+
|
|
1209
|
+
A must have been created with one of sparse_matrix_create_float or
|
|
1210
|
+
sparse_matrix_create_double.
|
|
1211
|
+
|
|
1212
|
+
Note that matrix properties cannot be modified after value insertion begins.
|
|
1213
|
+
This includes properties such as specifying a triangular matrix.
|
|
1214
|
+
|
|
1215
|
+
Insertion can be expensive, generally speaking it is best to do a batch update.
|
|
1216
|
+
Inserted values may be temporarily held internally within the object and only
|
|
1217
|
+
inserted into the sparse format when a later computation triggers a need to
|
|
1218
|
+
insert.
|
|
1219
|
+
|
|
1220
|
+
*/
|
|
1221
|
+
sparse_status sparse_insert_entry_float( sparse_matrix_float A, float val,
|
|
1222
|
+
sparse_index i, sparse_index j )
|
|
1223
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1224
|
+
|
|
1225
|
+
sparse_status sparse_insert_entry_double( sparse_matrix_double A, double val,
|
|
1226
|
+
sparse_index i, sparse_index j )
|
|
1227
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1228
|
+
|
|
1229
|
+
sparse_status sparse_insert_entry_float_complex( sparse_matrix_float_complex A, float _Complex val,
|
|
1230
|
+
sparse_index i, sparse_index j )
|
|
1231
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1232
|
+
|
|
1233
|
+
sparse_status sparse_insert_entry_double_complex( sparse_matrix_double_complex A, double _Complex val,
|
|
1234
|
+
sparse_index i, sparse_index j )
|
|
1235
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1236
|
+
|
|
1237
|
+
/*!
|
|
1238
|
+
@abstract
|
|
1239
|
+
Use to build a sparse matrix by providing a list of point entries. For each
|
|
1240
|
+
entry provided, update A[indx[i],jndx[i]] = val[i]. A must have been created
|
|
1241
|
+
with one of sparse_matrix_create_float or sparse_matrix_create_double.
|
|
1242
|
+
|
|
1243
|
+
@param A
|
|
1244
|
+
The sparse matrix. A must have been created with one of sparse_matrix_create_float
|
|
1245
|
+
or sparse_matrix_create_double. SPARSE_ILLEGAL_PARAMETER is returned if not met.
|
|
1246
|
+
|
|
1247
|
+
@param N
|
|
1248
|
+
The number of values to insert into A. Each of indx, jndx and val are of size
|
|
1249
|
+
N.
|
|
1250
|
+
|
|
1251
|
+
@param val
|
|
1252
|
+
Pointer to list of scalar values to insert into the sparse matrix. The value
|
|
1253
|
+
is inserted into the location specified by the corresponding indices in indx
|
|
1254
|
+
and jndx. Must hold N values.
|
|
1255
|
+
|
|
1256
|
+
@param indx
|
|
1257
|
+
An array of row indices that correspond to the values in val. Must hold N
|
|
1258
|
+
values.
|
|
1259
|
+
|
|
1260
|
+
Indices are assumed to be unique. Additionally, indices are assumed to be in the
|
|
1261
|
+
bounds of the matrix. Undefined behavior if any of these assumptions are not
|
|
1262
|
+
met.
|
|
1263
|
+
|
|
1264
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
1265
|
+
|
|
1266
|
+
@param jndx
|
|
1267
|
+
An array of column indices that correspond to the values in val. Must hold N
|
|
1268
|
+
values.
|
|
1269
|
+
|
|
1270
|
+
Indices are assumed to be unique. Additionally, indices are assumed to be in the
|
|
1271
|
+
bounds of the matrix. Undefined behavior if any of these assumptions are not
|
|
1272
|
+
met.
|
|
1273
|
+
|
|
1274
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
1275
|
+
|
|
1276
|
+
@result
|
|
1277
|
+
On successful insertion, A has been updated with the values and SPARSE_SUCCESS is
|
|
1278
|
+
returned. If A creation requirements are not met, SPARSE_ILLEGAL_PARAMETER is
|
|
1279
|
+
returned and A is unchanged.
|
|
1280
|
+
|
|
1281
|
+
@discussion
|
|
1282
|
+
Use to build a sparse matrix by providing a list of point entries. For each
|
|
1283
|
+
entry provided, update A[indx[i],jndx[i]] = val[i].
|
|
1284
|
+
|
|
1285
|
+
A must have been created with one of sparse_matrix_create_float or
|
|
1286
|
+
sparse_matrix_create_double.
|
|
1287
|
+
|
|
1288
|
+
Note that matrix properties cannot be modified after value insertion begins.
|
|
1289
|
+
This includes properties such as specifying a triangular matrix.
|
|
1290
|
+
|
|
1291
|
+
Insertion can be expensive, generally speaking it is best to do a batch update.
|
|
1292
|
+
Inserted values may be temporarily held internally within the object and only
|
|
1293
|
+
inserted into the sparse format when a later computation triggers a need to
|
|
1294
|
+
insert.
|
|
1295
|
+
|
|
1296
|
+
*/
|
|
1297
|
+
sparse_status sparse_insert_entries_float( sparse_matrix_float A, sparse_dimension N,
|
|
1298
|
+
const float * __restrict val,
|
|
1299
|
+
const sparse_index * __restrict indx,
|
|
1300
|
+
const sparse_index * __restrict jndx )
|
|
1301
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1302
|
+
|
|
1303
|
+
sparse_status sparse_insert_entries_double( sparse_matrix_double A, sparse_dimension N,
|
|
1304
|
+
const double * __restrict val,
|
|
1305
|
+
const sparse_index * __restrict indx,
|
|
1306
|
+
const sparse_index * __restrict jndx )
|
|
1307
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1308
|
+
|
|
1309
|
+
sparse_status sparse_insert_entries_float_complex( sparse_matrix_float_complex A, sparse_dimension N,
|
|
1310
|
+
const float _Complex * __restrict val,
|
|
1311
|
+
const sparse_index * __restrict indx,
|
|
1312
|
+
const sparse_index * __restrict jndx )
|
|
1313
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1314
|
+
|
|
1315
|
+
sparse_status sparse_insert_entries_double_complex( sparse_matrix_double_complex A, sparse_dimension N,
|
|
1316
|
+
const double _Complex * __restrict val,
|
|
1317
|
+
const sparse_index * __restrict indx,
|
|
1318
|
+
const sparse_index * __restrict jndx )
|
|
1319
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1320
|
+
|
|
1321
|
+
/*!
|
|
1322
|
+
@abstract
|
|
1323
|
+
Use to build a sparse matrix by providing a list of point entries for a single
|
|
1324
|
+
column. For each entry provided, update A[indx[i],j] = val[i]. A must have
|
|
1325
|
+
been created with one of sparse_matrix_create_float or sparse_matrix_create_double.
|
|
1326
|
+
|
|
1327
|
+
@param A
|
|
1328
|
+
The sparse matrix. A must have been created with one of sparse_matrix_create_float
|
|
1329
|
+
or sparse_matrix_create_double. SPARSE_ILLEGAL_PARAMETER is returned if not met.
|
|
1330
|
+
|
|
1331
|
+
@param j
|
|
1332
|
+
The column for value insertion. Indices are 0 based (first element of pointer
|
|
1333
|
+
is ptr[0]). Indices expected to be in the bounds of matrix dimensions,
|
|
1334
|
+
undefined behavior if not met.
|
|
1335
|
+
|
|
1336
|
+
@param nz
|
|
1337
|
+
The number of values to insert into A. Each of indx and val are of size
|
|
1338
|
+
nz.
|
|
1339
|
+
|
|
1340
|
+
@param val
|
|
1341
|
+
Pointer to list of scalar values to insert into the sparse matrix. The value
|
|
1342
|
+
is inserted into the location specified by the corresponding indices of indx
|
|
1343
|
+
and j. Must hold nz values.
|
|
1344
|
+
|
|
1345
|
+
@param indx
|
|
1346
|
+
An array of column indices that correspond to the values in val. Must hold nz
|
|
1347
|
+
values.
|
|
1348
|
+
|
|
1349
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
1350
|
+
indices are assumed to be unique. Finally, indices are assumed to be in the
|
|
1351
|
+
bounds of the matrix. Undefined behavior if any of these assumptions are not
|
|
1352
|
+
met.
|
|
1353
|
+
|
|
1354
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
1355
|
+
|
|
1356
|
+
@result
|
|
1357
|
+
On successful insertion, A has been updated with the value and SPARSE_SUCCESS is
|
|
1358
|
+
returned. If A creation requirements are not met, SPARSE_ILLEGAL_PARAMETER is
|
|
1359
|
+
returned and A is unchanged.
|
|
1360
|
+
|
|
1361
|
+
@discussion
|
|
1362
|
+
Use to build a sparse matrix by providing a list of point entries for a single
|
|
1363
|
+
column. For each entry provided, update A[indx[i],j] = val[i]. This will not
|
|
1364
|
+
replace the existing contents of the column, it appends new values and
|
|
1365
|
+
overwrites overlapping values.
|
|
1366
|
+
|
|
1367
|
+
A must have been created with one of sparse_matrix_create_float or
|
|
1368
|
+
sparse_matrix_create_double.
|
|
1369
|
+
|
|
1370
|
+
Note that matrix properties cannot be modified after value insertion begins.
|
|
1371
|
+
This includes properties such as specifying a triangular matrix.
|
|
1372
|
+
|
|
1373
|
+
Insertion can be expensive, generally speaking it is best to do a batch update.
|
|
1374
|
+
Inserted values may be temporarily held internally within the object and only
|
|
1375
|
+
inserted into the sparse format when a later computation triggers a need to
|
|
1376
|
+
insert.
|
|
1377
|
+
|
|
1378
|
+
*/
|
|
1379
|
+
sparse_status sparse_insert_col_float( sparse_matrix_float A, sparse_index j,
|
|
1380
|
+
sparse_dimension nz, const float * __restrict val,
|
|
1381
|
+
const sparse_index * __restrict indx )
|
|
1382
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1383
|
+
|
|
1384
|
+
sparse_status sparse_insert_col_double( sparse_matrix_double A, sparse_index j,
|
|
1385
|
+
sparse_dimension nz, const double * __restrict val,
|
|
1386
|
+
const sparse_index * __restrict indx )
|
|
1387
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1388
|
+
|
|
1389
|
+
sparse_status sparse_insert_col_float_complex( sparse_matrix_float_complex A, sparse_index j,
|
|
1390
|
+
sparse_dimension nz, const float _Complex * __restrict val,
|
|
1391
|
+
const sparse_index * __restrict indx )
|
|
1392
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1393
|
+
|
|
1394
|
+
sparse_status sparse_insert_col_double_complex( sparse_matrix_double_complex A, sparse_index j,
|
|
1395
|
+
sparse_dimension nz, const double _Complex * __restrict val,
|
|
1396
|
+
const sparse_index * __restrict indx )
|
|
1397
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1398
|
+
|
|
1399
|
+
/*!
|
|
1400
|
+
@abstract
|
|
1401
|
+
Use to build a sparse matrix by providing a list of point entries for a single
|
|
1402
|
+
row. For each entry provided, update A[i,jndx[i]] = val[i]. A must have been
|
|
1403
|
+
created with one of sparse_matrix_create_float or sparse_matrix_create_double.
|
|
1404
|
+
|
|
1405
|
+
@param A
|
|
1406
|
+
The sparse matrix. A must have been created with one of sparse_matrix_create_float
|
|
1407
|
+
or sparse_matrix_create_double. SPARSE_ILLEGAL_PARAMETER is returned if not met.
|
|
1408
|
+
|
|
1409
|
+
@param i
|
|
1410
|
+
The row for value insertion. Indices are 0 based (first element of pointer is
|
|
1411
|
+
ptr[0]). Indices expected to be in the bounds of matrix dimensions,
|
|
1412
|
+
undefined behavior if not met.
|
|
1413
|
+
|
|
1414
|
+
@param nz
|
|
1415
|
+
The number of values to insert into A. Each of jndx and val are of size
|
|
1416
|
+
nz.
|
|
1417
|
+
|
|
1418
|
+
@param val
|
|
1419
|
+
Pointer to list of scalar values to insert into the sparse matrix. The value
|
|
1420
|
+
is inserted into the location specified by the corresponding indices of i and
|
|
1421
|
+
jndx. Must hold nz values.
|
|
1422
|
+
|
|
1423
|
+
@param jndx
|
|
1424
|
+
An array of column indices that correspond to the values in val. Must hold nz
|
|
1425
|
+
values.
|
|
1426
|
+
|
|
1427
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
1428
|
+
indices are assumed to be unique. Finally, indices are assumed to be in the
|
|
1429
|
+
bounds of the matrix. Undefined behavior if any of these assumptions are not
|
|
1430
|
+
met.
|
|
1431
|
+
|
|
1432
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
1433
|
+
|
|
1434
|
+
@result
|
|
1435
|
+
On successful insertion, A has been updated with the value and SPARSE_SUCCESS is
|
|
1436
|
+
returned. If A creation requirements are not met, SPARSE_ILLEGAL_PARAMETER is
|
|
1437
|
+
returned and A is unchanged.
|
|
1438
|
+
|
|
1439
|
+
@discussion
|
|
1440
|
+
Use to build a sparse matrix by providing a list of point entries for a single
|
|
1441
|
+
row. For each entry provided, update A[i,jndx[i]] = val[i]. This will not
|
|
1442
|
+
replace the existing contents of the row, it appends new values and
|
|
1443
|
+
overwrites overlapping values.
|
|
1444
|
+
|
|
1445
|
+
A must have been created with one of sparse_matrix_create_float or
|
|
1446
|
+
sparse_matrix_create_double.
|
|
1447
|
+
|
|
1448
|
+
Note that matrix properties cannot be modified after value insertion begins.
|
|
1449
|
+
This includes properties such as specifying a triangular matrix.
|
|
1450
|
+
|
|
1451
|
+
Insertion can be expensive, generally speaking it is best to do a batch update.
|
|
1452
|
+
Inserted values may be temporarily held internally within the object and only
|
|
1453
|
+
inserted into the sparse format when a later computation triggers a need to
|
|
1454
|
+
insert.
|
|
1455
|
+
|
|
1456
|
+
*/
|
|
1457
|
+
sparse_status sparse_insert_row_float( sparse_matrix_float A, sparse_index i,
|
|
1458
|
+
sparse_dimension nz, const float * __restrict val,
|
|
1459
|
+
const sparse_index * __restrict jndx )
|
|
1460
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1461
|
+
|
|
1462
|
+
sparse_status sparse_insert_row_double( sparse_matrix_double A, sparse_index i,
|
|
1463
|
+
sparse_dimension nz, const double * __restrict val,
|
|
1464
|
+
const sparse_index * __restrict jndx )
|
|
1465
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1466
|
+
|
|
1467
|
+
sparse_status sparse_insert_row_float_complex( sparse_matrix_float_complex A, sparse_index i,
|
|
1468
|
+
sparse_dimension nz, const float _Complex * __restrict val,
|
|
1469
|
+
const sparse_index * __restrict jndx )
|
|
1470
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1471
|
+
|
|
1472
|
+
sparse_status sparse_insert_row_double_complex( sparse_matrix_double_complex A, sparse_index i,
|
|
1473
|
+
sparse_dimension nz, const double _Complex * __restrict val,
|
|
1474
|
+
const sparse_index * __restrict jndx )
|
|
1475
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1476
|
+
|
|
1477
|
+
/*!
|
|
1478
|
+
@abstract
|
|
1479
|
+
Extract the first nz values of the row begining at A[row,column_start] for the
|
|
1480
|
+
sparse matrix A. A must have been created with one of sparse_matrix_create_float
|
|
1481
|
+
or sparse_matrix_create_double.
|
|
1482
|
+
|
|
1483
|
+
@param A
|
|
1484
|
+
The sparse matrix. A must have been created with one of
|
|
1485
|
+
sparse_matrix_create_float or sparse_matrix_create_double. SPARSE_ILLEGAL_PARAMETER is
|
|
1486
|
+
returned if not met.
|
|
1487
|
+
|
|
1488
|
+
@param row
|
|
1489
|
+
The row for value extraction. Indices are 0 based (first element of pointer is
|
|
1490
|
+
ptr[0]). Indices expected to be in the bounds of matrix dimensions,
|
|
1491
|
+
undefined behavior if not met.
|
|
1492
|
+
|
|
1493
|
+
@param column_start
|
|
1494
|
+
The index of the column to start extraction. Indices are 0 based (first
|
|
1495
|
+
element of pointer is ptr[0]). Indices expected to be in the bounds of matrix
|
|
1496
|
+
dimensions, undefined behavior if not met.
|
|
1497
|
+
|
|
1498
|
+
@param column_end
|
|
1499
|
+
On return, holds the column index of the next nonzero value. If there is no
|
|
1500
|
+
next nonzero value (because all of them have been copied into the sparse
|
|
1501
|
+
vector), it holds the number of columns in the matrix.
|
|
1502
|
+
Indices are 0 based (first element of pointer is ptr[0]).
|
|
1503
|
+
Indices expected to be in the bounds of matrix dimensions, undefined behavior
|
|
1504
|
+
if not met.
|
|
1505
|
+
|
|
1506
|
+
@param nz
|
|
1507
|
+
The number of values to extract from A. Each of jndx and val are of size
|
|
1508
|
+
nz.
|
|
1509
|
+
|
|
1510
|
+
@param val
|
|
1511
|
+
Pointer to array to hold the values extracted from the sparse matrix. The
|
|
1512
|
+
value is extracted from the location specified by the corresponding indices of
|
|
1513
|
+
row and jndx. Must be of size nz elements. If less than nz nonzero values are
|
|
1514
|
+
found, then the last nz - actual_nonzero_count elements of val are untouched.
|
|
1515
|
+
|
|
1516
|
+
@param jndx
|
|
1517
|
+
An array to hold the extracted column indices that correspond to the values in
|
|
1518
|
+
val. Note that these indices are relative to the matrix row and not the
|
|
1519
|
+
starting column index specified by column_start. Returned indices are 0 based
|
|
1520
|
+
(first element of pointer is ptr[0]). Must be of size nz elements.
|
|
1521
|
+
|
|
1522
|
+
@result
|
|
1523
|
+
On success val and jndx have been updated with the nonzero values of the row'th
|
|
1524
|
+
row, column_end holds the column index of the next nonzero value, and
|
|
1525
|
+
the number of nonzero values written are returned. If A creation requirements
|
|
1526
|
+
are not met, SPARSE_ILLEGAL_PARAMETER is returned and val and jndx are unchanged.
|
|
1527
|
+
|
|
1528
|
+
@discussion
|
|
1529
|
+
Extract the first nz values of the row begining at A[row,column_start] for the
|
|
1530
|
+
sparse matrix A. The number of nonzero values extracted is limited by nz, and
|
|
1531
|
+
the number of nonzero's written to jndx and val are returned. Additionally,
|
|
1532
|
+
the column index of the next nonzero value is returned in column_end.
|
|
1533
|
+
For example if nz is returned, not all nonzero values have been extracted,
|
|
1534
|
+
and a second extract can start from column_end.
|
|
1535
|
+
|
|
1536
|
+
A must have been created with one of sparse_matrix_create_float or
|
|
1537
|
+
sparse_matrix_create_double.
|
|
1538
|
+
|
|
1539
|
+
*/
|
|
1540
|
+
sparse_status sparse_extract_sparse_row_float( sparse_matrix_float A, sparse_index row,
|
|
1541
|
+
sparse_index column_start, sparse_index *column_end,
|
|
1542
|
+
sparse_dimension nz, float * __restrict val,
|
|
1543
|
+
sparse_index * __restrict jndx )
|
|
1544
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1545
|
+
|
|
1546
|
+
sparse_status sparse_extract_sparse_row_double( sparse_matrix_double A, sparse_index row,
|
|
1547
|
+
sparse_index column_start, sparse_index *column_end,
|
|
1548
|
+
sparse_dimension nz, double * __restrict val,
|
|
1549
|
+
sparse_index * __restrict jndx )
|
|
1550
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1551
|
+
|
|
1552
|
+
sparse_status sparse_extract_sparse_row_float_complex( sparse_matrix_float_complex A, sparse_index row,
|
|
1553
|
+
sparse_index column_start, sparse_index *column_end,
|
|
1554
|
+
sparse_dimension nz, float _Complex * __restrict val,
|
|
1555
|
+
sparse_index * __restrict jndx )
|
|
1556
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1557
|
+
|
|
1558
|
+
sparse_status sparse_extract_sparse_row_double_complex( sparse_matrix_double_complex A, sparse_index row,
|
|
1559
|
+
sparse_index column_start, sparse_index *column_end,
|
|
1560
|
+
sparse_dimension nz, double _Complex * __restrict val,
|
|
1561
|
+
sparse_index * __restrict jndx )
|
|
1562
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1563
|
+
|
|
1564
|
+
/*!
|
|
1565
|
+
@abstract
|
|
1566
|
+
Extract the first nz values of the column begining at A[row_start,column] for
|
|
1567
|
+
the sparse matrix A. A must have been created with one of
|
|
1568
|
+
sparse_matrix_create_float or sparse_matrix_create_double.
|
|
1569
|
+
|
|
1570
|
+
@param A
|
|
1571
|
+
The sparse matrix. A must have been created with one of
|
|
1572
|
+
sparse_matrix_create_float or sparse_matrix_create_double. SPARSE_ILLEGAL_PARAMETER is
|
|
1573
|
+
returned if not met.
|
|
1574
|
+
|
|
1575
|
+
@param column
|
|
1576
|
+
The column for value extraction. Indices are 0 based (first element of pointer
|
|
1577
|
+
is ptr[0]). Indices expected to be in the bounds of matrix dimensions,
|
|
1578
|
+
undefined behavior if not met.
|
|
1579
|
+
|
|
1580
|
+
@param row_start
|
|
1581
|
+
The index of the row to start extraction. Indices are 0 based (first
|
|
1582
|
+
element of pointer is ptr[0]). Indices expected to be in the bounds of matrix
|
|
1583
|
+
dimensions, undefined behavior if not met.
|
|
1584
|
+
|
|
1585
|
+
@param row_end
|
|
1586
|
+
On return, holds the row index of the next nonzero value. If there is no
|
|
1587
|
+
next nonzero value (because all of them have been copied into the sparse
|
|
1588
|
+
vector), it holds the number of rows in the matrix.
|
|
1589
|
+
Indices are 0 based (first element of pointer is ptr[0]).
|
|
1590
|
+
Indices expected to be in the bounds of matrix dimensions, undefined behavior
|
|
1591
|
+
if not met.
|
|
1592
|
+
|
|
1593
|
+
@param nz
|
|
1594
|
+
The number of values to extract from A. Each of indx and val are of size
|
|
1595
|
+
nz.
|
|
1596
|
+
|
|
1597
|
+
@param val
|
|
1598
|
+
Pointer to array to hold the values extracted from the sparse matrix. The
|
|
1599
|
+
value is extracted from the location specified by the corresponding indices of
|
|
1600
|
+
column and indx. Must be of size nz elements. If less than nz nonzero values
|
|
1601
|
+
are found, then the last nz - actual_nonzero_count elements of val are
|
|
1602
|
+
untouched.
|
|
1603
|
+
|
|
1604
|
+
@param indx
|
|
1605
|
+
An array to hold the extracted row indices that correspond to the values in
|
|
1606
|
+
val. Note that these indices are relative to the matrix column and not the
|
|
1607
|
+
starting row index specified by row_start. Returned indices are 0 based
|
|
1608
|
+
(first element of pointer is ptr[0]). Must be of size nz elements.
|
|
1609
|
+
|
|
1610
|
+
@result
|
|
1611
|
+
On success val and indx have been updated with the nonzero values of the
|
|
1612
|
+
column'th column, row_end holds the row index of the next nonzero value,
|
|
1613
|
+
and the number of nonzero values written are returned. If A creation
|
|
1614
|
+
requirements are not met, SPARSE_ILLEGAL_PARAMETER is returned and val and indx
|
|
1615
|
+
are unchanged.
|
|
1616
|
+
|
|
1617
|
+
@discussion
|
|
1618
|
+
Extract the first nz values of the column begining at A[column,row_start] for
|
|
1619
|
+
the sparse matrix A. The number of nonzero values extracted is limited by nz,
|
|
1620
|
+
and the number of nonzero's written to indx and val are returned.
|
|
1621
|
+
Additionally, the row index of the next nonzero value is returned in
|
|
1622
|
+
row_end. For example if nz is returned, not all nonzero values have been
|
|
1623
|
+
extracted, and a second extract can start from row_end.
|
|
1624
|
+
|
|
1625
|
+
A must have been created with one of sparse_matrix_create_float or
|
|
1626
|
+
sparse_matrix_create_double.
|
|
1627
|
+
|
|
1628
|
+
*/
|
|
1629
|
+
sparse_status sparse_extract_sparse_column_float( sparse_matrix_float A,
|
|
1630
|
+
sparse_index column,
|
|
1631
|
+
sparse_index row_start,
|
|
1632
|
+
sparse_index *row_end,
|
|
1633
|
+
sparse_dimension nz,
|
|
1634
|
+
float * __restrict val,
|
|
1635
|
+
sparse_index * __restrict indx )
|
|
1636
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1637
|
+
|
|
1638
|
+
sparse_status sparse_extract_sparse_column_double( sparse_matrix_double A,
|
|
1639
|
+
sparse_index column,
|
|
1640
|
+
sparse_index row_start,
|
|
1641
|
+
sparse_index *row_end,
|
|
1642
|
+
sparse_dimension nz,
|
|
1643
|
+
double * __restrict val,
|
|
1644
|
+
sparse_index * __restrict indx )
|
|
1645
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1646
|
+
|
|
1647
|
+
sparse_status sparse_extract_sparse_column_float_complex( sparse_matrix_float_complex A,
|
|
1648
|
+
sparse_index column,
|
|
1649
|
+
sparse_index row_start,
|
|
1650
|
+
sparse_index *row_end,
|
|
1651
|
+
sparse_dimension nz,
|
|
1652
|
+
float _Complex * __restrict val,
|
|
1653
|
+
sparse_index * __restrict indx )
|
|
1654
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1655
|
+
|
|
1656
|
+
sparse_status sparse_extract_sparse_column_double_complex( sparse_matrix_double_complex A,
|
|
1657
|
+
sparse_index column,
|
|
1658
|
+
sparse_index row_start,
|
|
1659
|
+
sparse_index *row_end,
|
|
1660
|
+
sparse_dimension nz,
|
|
1661
|
+
double _Complex * __restrict val,
|
|
1662
|
+
sparse_index * __restrict indx )
|
|
1663
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1664
|
+
|
|
1665
|
+
#pragma mark - Block Wise Matrix Routines -
|
|
1666
|
+
|
|
1667
|
+
/* Block Wise Matrix Routines */
|
|
1668
|
+
/*!
|
|
1669
|
+
@functiongroup Block Wise Matrix Routines
|
|
1670
|
+
@abstract Routines to create and insert values in a block wise sparse matrix.
|
|
1671
|
+
*/
|
|
1672
|
+
|
|
1673
|
+
/*!
|
|
1674
|
+
@abstract
|
|
1675
|
+
Create a sparse matrix object that is stored in block-entry format and is ready
|
|
1676
|
+
to receive values from the various block insert routines. Blocks are of fixed
|
|
1677
|
+
dimension k x l.
|
|
1678
|
+
|
|
1679
|
+
@param Mb
|
|
1680
|
+
The number of rows in terms of blocks of the matrix. There are a total of
|
|
1681
|
+
Mb * k rows in the matrix. Must be greater than 0.
|
|
1682
|
+
|
|
1683
|
+
@param Nb
|
|
1684
|
+
The number of columns in terms of blocks of the matrix. There are a total of
|
|
1685
|
+
Nb * l columns in the matrix. Must be greater than 0.
|
|
1686
|
+
|
|
1687
|
+
@param k
|
|
1688
|
+
The row dimension of a block in the sparse matrix. Must be greater than 0.
|
|
1689
|
+
|
|
1690
|
+
@param l
|
|
1691
|
+
The column dimension of a block in the sparse matrix. Must be greater than 0.
|
|
1692
|
+
|
|
1693
|
+
@result
|
|
1694
|
+
On success, returns a matrix object that is ready for receiving entries. If an
|
|
1695
|
+
error occurs, NULL is returned.
|
|
1696
|
+
|
|
1697
|
+
@discussion
|
|
1698
|
+
Create a sparse matrix object that is stored in block-entry format and is ready
|
|
1699
|
+
to receive values from the various block insert routines. Blocks are are of
|
|
1700
|
+
fixed dimensions k x l. Block-entry format means blocks of dense regions will
|
|
1701
|
+
be stored at block indices i,j. For point wise format use non block version of
|
|
1702
|
+
create. See the various insert routines for details on inserting values into
|
|
1703
|
+
this matrix object.
|
|
1704
|
+
|
|
1705
|
+
The dimensions Mb, Nb, k, and l must be greater than 0. On success a valid
|
|
1706
|
+
matrix object is returned, otherwise NULL is returned.
|
|
1707
|
+
|
|
1708
|
+
*/
|
|
1709
|
+
sparse_matrix_float sparse_matrix_block_create_float( sparse_dimension Mb,
|
|
1710
|
+
sparse_dimension Nb,
|
|
1711
|
+
sparse_dimension k,
|
|
1712
|
+
sparse_dimension l )
|
|
1713
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1714
|
+
|
|
1715
|
+
sparse_matrix_double sparse_matrix_block_create_double( sparse_dimension Mb,
|
|
1716
|
+
sparse_dimension Nb,
|
|
1717
|
+
sparse_dimension k,
|
|
1718
|
+
sparse_dimension l )
|
|
1719
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1720
|
+
|
|
1721
|
+
sparse_matrix_float_complex sparse_matrix_block_create_float_complex( sparse_dimension Mb,
|
|
1722
|
+
sparse_dimension Nb,
|
|
1723
|
+
sparse_dimension k,
|
|
1724
|
+
sparse_dimension l )
|
|
1725
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1726
|
+
|
|
1727
|
+
sparse_matrix_double_complex sparse_matrix_block_create_double_complex( sparse_dimension Mb,
|
|
1728
|
+
sparse_dimension Nb,
|
|
1729
|
+
sparse_dimension k,
|
|
1730
|
+
sparse_dimension l )
|
|
1731
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1732
|
+
|
|
1733
|
+
/*!
|
|
1734
|
+
@abstract
|
|
1735
|
+
Create a sparse matrix object that is stored in block-entry format and is ready
|
|
1736
|
+
to receive values from the various block insert routines. Blocks are of
|
|
1737
|
+
variable dimensions where the i,j'th block has dimensions K[i] x L[j].
|
|
1738
|
+
|
|
1739
|
+
@param Mb
|
|
1740
|
+
The number of rows in terms of blocks of the matrix. Must be greater than 0.
|
|
1741
|
+
|
|
1742
|
+
@param Nb
|
|
1743
|
+
The number of columns in terms of blocks of the matrix. Must be greater
|
|
1744
|
+
than 0.
|
|
1745
|
+
|
|
1746
|
+
@param K
|
|
1747
|
+
Array containing row dimensions of the blocks. The i'th row in terms of blocks
|
|
1748
|
+
will have a dimension K[i]. K is expected to hold Mb elements. All values of
|
|
1749
|
+
K are expected to be greater than 0.
|
|
1750
|
+
|
|
1751
|
+
@param L
|
|
1752
|
+
Array containing column dimensions of the blocks. The j'th column in terms of
|
|
1753
|
+
blocks will have a dimension L[j]. L is expected to hold Nb elements. All
|
|
1754
|
+
values of L are expected to be greater than 0.
|
|
1755
|
+
|
|
1756
|
+
@result
|
|
1757
|
+
On success, returns a matrix object that is ready for receiving entries. If an
|
|
1758
|
+
error occurs, NULL is returned.
|
|
1759
|
+
|
|
1760
|
+
@discussion
|
|
1761
|
+
Create a sparse matrix object that is stored in block-entry format and is ready
|
|
1762
|
+
to receive values from the various block insert routines. Blocks are are of
|
|
1763
|
+
variable dimension where the i,j'th block index has a dimension K[i] x L[j].
|
|
1764
|
+
Block-entry format means blocks of dense regions will be stored at block
|
|
1765
|
+
indices i,j. For point wise format use non block version of create. See the
|
|
1766
|
+
various insert routines for details on inserting values into this matrix
|
|
1767
|
+
object.
|
|
1768
|
+
|
|
1769
|
+
The dimensions Mb, Nb and all values in K and L must be greater than 0. On
|
|
1770
|
+
success a valid matrix object is returned, otherwise NULL is returned.
|
|
1771
|
+
|
|
1772
|
+
*/
|
|
1773
|
+
sparse_matrix_float sparse_matrix_variable_block_create_float( sparse_dimension Mb,
|
|
1774
|
+
sparse_dimension Nb,
|
|
1775
|
+
const sparse_dimension *K,
|
|
1776
|
+
const sparse_dimension *L )
|
|
1777
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1778
|
+
|
|
1779
|
+
sparse_matrix_double sparse_matrix_variable_block_create_double( sparse_dimension Mb,
|
|
1780
|
+
sparse_dimension Nb,
|
|
1781
|
+
const sparse_dimension *K,
|
|
1782
|
+
const sparse_dimension *L )
|
|
1783
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1784
|
+
|
|
1785
|
+
sparse_matrix_float_complex sparse_matrix_variable_block_create_float_complex( sparse_dimension Mb,
|
|
1786
|
+
sparse_dimension Nb,
|
|
1787
|
+
const sparse_dimension *K,
|
|
1788
|
+
const sparse_dimension *L )
|
|
1789
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1790
|
+
|
|
1791
|
+
sparse_matrix_double_complex sparse_matrix_variable_block_create_double_complex( sparse_dimension Mb,
|
|
1792
|
+
sparse_dimension Nb,
|
|
1793
|
+
const sparse_dimension *K,
|
|
1794
|
+
const sparse_dimension *L )
|
|
1795
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1796
|
+
|
|
1797
|
+
/*!
|
|
1798
|
+
@abstract
|
|
1799
|
+
Use to build a sparse matrix by providing a dense block for entry at block
|
|
1800
|
+
location A[bi,bj]. Block size is determined at object creation time. A must
|
|
1801
|
+
have been created with one of sparse_matrix_block_create_float,
|
|
1802
|
+
sparse_matrix_block_create_double, sparse_matrix_variable_block_create_float, or
|
|
1803
|
+
sparse_matrix_variable_block_create_double.
|
|
1804
|
+
|
|
1805
|
+
@param A
|
|
1806
|
+
The sparse matrix. A must have been created with one of
|
|
1807
|
+
sparse_matrix_block_create_float, sparse_matrix_block_create_double,
|
|
1808
|
+
sparse_matrix_variable_block_create_float, or
|
|
1809
|
+
sparse_matrix_variable_block_create_double. SPARSE_ILLEGAL_PARAMETER is returned if
|
|
1810
|
+
not met. A holds block dimensions (fixed or variable) set with matrix object
|
|
1811
|
+
creation routine.
|
|
1812
|
+
|
|
1813
|
+
@param val
|
|
1814
|
+
Pointer to block to be inserted at block index location A[bi,bj]. The block is
|
|
1815
|
+
of dimension k x l where k and l are set for bi,bj at object creation time.
|
|
1816
|
+
The strides between elements for rows and columns are provided in row_stride
|
|
1817
|
+
and col_stride.
|
|
1818
|
+
|
|
1819
|
+
@param row_stride
|
|
1820
|
+
The row stride in number of elements to move from one row to the next for the
|
|
1821
|
+
block val.
|
|
1822
|
+
|
|
1823
|
+
@param col_stride
|
|
1824
|
+
The column stride in number of elements to move from one column to the next for
|
|
1825
|
+
the block val.
|
|
1826
|
+
|
|
1827
|
+
@param bi
|
|
1828
|
+
The block row index where val is to be inserted. Indexing is zero based, the
|
|
1829
|
+
first block is located at 0,0. Index is assumed to be within the bounds of the
|
|
1830
|
+
matrix object, undefined behavior if not met.
|
|
1831
|
+
|
|
1832
|
+
@param bj
|
|
1833
|
+
The block column index where val is to be inserted. Indexing is zero based, the
|
|
1834
|
+
first block is located at 0,0. Index is assumed to be within the bounds of the
|
|
1835
|
+
matrix object, undefined behavior if not met.
|
|
1836
|
+
|
|
1837
|
+
@result
|
|
1838
|
+
On successful insertion, A has been updated with the value and SPARSE_SUCCESS is
|
|
1839
|
+
returned. If A creation requirements are not met, SPARSE_ILLEGAL_PARAMETER is
|
|
1840
|
+
returned and A is unchanged.
|
|
1841
|
+
|
|
1842
|
+
@discussion
|
|
1843
|
+
Use to build a sparse matrix by providing a dense block for entry at block
|
|
1844
|
+
location A[bi,bj]. Block size is determined at object creation time. Given a
|
|
1845
|
+
block dimension of k x l and for location bi,bj, update as:
|
|
1846
|
+
A[bi,bj][i,j] = val[i*row_stride + j*col_stride] for each i in k and each j in
|
|
1847
|
+
l.
|
|
1848
|
+
|
|
1849
|
+
A must have been created with one of sparse_matrix_block_create_float,
|
|
1850
|
+
sparse_matrix_block_create_double, sparse_matrix_variable_block_create_float, or
|
|
1851
|
+
sparse_matrix_variable_block_create_double.
|
|
1852
|
+
|
|
1853
|
+
Note that matrix properties cannot be modified after value insertion begins.
|
|
1854
|
+
This includes properties such as specifying a triangular matrix.
|
|
1855
|
+
|
|
1856
|
+
Insertion can be expensive, generally speaking it is best to do a batch update.
|
|
1857
|
+
Inserted values may be temporarily held internally within the object and only
|
|
1858
|
+
inserted into the sparse format when a later computation triggers a need to
|
|
1859
|
+
insert.
|
|
1860
|
+
|
|
1861
|
+
*/
|
|
1862
|
+
sparse_status sparse_insert_block_float( sparse_matrix_float A,
|
|
1863
|
+
const float * __restrict val,
|
|
1864
|
+
sparse_dimension row_stride,
|
|
1865
|
+
sparse_dimension col_stride,
|
|
1866
|
+
sparse_index bi, sparse_index bj )
|
|
1867
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1868
|
+
|
|
1869
|
+
sparse_status sparse_insert_block_double( sparse_matrix_double A,
|
|
1870
|
+
const double * __restrict val,
|
|
1871
|
+
sparse_dimension row_stride,
|
|
1872
|
+
sparse_dimension col_stride,
|
|
1873
|
+
sparse_index bi, sparse_index bj )
|
|
1874
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1875
|
+
|
|
1876
|
+
sparse_status sparse_insert_block_float_complex( sparse_matrix_float_complex A,
|
|
1877
|
+
const float _Complex * __restrict val,
|
|
1878
|
+
sparse_dimension row_stride,
|
|
1879
|
+
sparse_dimension col_stride,
|
|
1880
|
+
sparse_index bi, sparse_index bj )
|
|
1881
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1882
|
+
|
|
1883
|
+
sparse_status sparse_insert_block_double_complex( sparse_matrix_double_complex A,
|
|
1884
|
+
const double _Complex * __restrict val,
|
|
1885
|
+
sparse_dimension row_stride,
|
|
1886
|
+
sparse_dimension col_stride,
|
|
1887
|
+
sparse_index bi, sparse_index bj )
|
|
1888
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1889
|
+
|
|
1890
|
+
/*!
|
|
1891
|
+
@abstract
|
|
1892
|
+
Extract the bi,bj'th block from the sparse matrix A. A must have been created
|
|
1893
|
+
with one of sparse_matrix_block_create_float, sparse_matrix_block_create_double,
|
|
1894
|
+
sparse_matrix_variable_block_create_float, or
|
|
1895
|
+
sparse_matrix_variable_block_create_double.
|
|
1896
|
+
|
|
1897
|
+
@param A
|
|
1898
|
+
The sparse matrix. A must have been created with one of
|
|
1899
|
+
sparse_matrix_block_create_float, sparse_matrix_block_create_double,
|
|
1900
|
+
sparse_matrix_variable_block_create_float, or
|
|
1901
|
+
sparse_matrix_variable_block_create_double. SPARSE_ILLEGAL_PARAMETER is returned if
|
|
1902
|
+
not met. A holds block dimensions (fixed or variable) set with matrix object
|
|
1903
|
+
creation routine.
|
|
1904
|
+
|
|
1905
|
+
@param bi
|
|
1906
|
+
The block row index for value extraction. Indices are 0 based (first block of
|
|
1907
|
+
matrix is A[0,0]). Indices expected to be in the bounds of matrix dimensions,
|
|
1908
|
+
undefined behavior if not met.
|
|
1909
|
+
|
|
1910
|
+
@param bj
|
|
1911
|
+
The block column index for value extraction. Indices are 0 based (first block
|
|
1912
|
+
of matrix is A[0,0]). Indices expected to be in the bounds of matrix
|
|
1913
|
+
dimensions, undefined behavior if not met.
|
|
1914
|
+
|
|
1915
|
+
@param row_stride
|
|
1916
|
+
The row stride in number of elements to move from one row to the next for the
|
|
1917
|
+
block val.
|
|
1918
|
+
|
|
1919
|
+
@param col_stride
|
|
1920
|
+
The column stride in number of elements to move from one column to the next for
|
|
1921
|
+
the block val.
|
|
1922
|
+
|
|
1923
|
+
@param val
|
|
1924
|
+
Pointer to dense block to place the extracted values. Expected to be of size
|
|
1925
|
+
K x L where K x L is the block size for the matrix object at block index bi,bj.
|
|
1926
|
+
This dimensions is set at matrix object creation time.
|
|
1927
|
+
|
|
1928
|
+
@result
|
|
1929
|
+
On success SPARSE_SUCCESS is return and val has been updated with the block from
|
|
1930
|
+
block index bi,bj. If A creation requirements are not met,
|
|
1931
|
+
SPARSE_ILLEGAL_PARAMETER is returned and val is unchanged.
|
|
1932
|
+
|
|
1933
|
+
@discussion
|
|
1934
|
+
Extract the bi,bj'th block from the sparse matrix A.
|
|
1935
|
+
|
|
1936
|
+
A must have been created with one of sparse_matrix_block_create_float,
|
|
1937
|
+
sparse_matrix_block_create_double, sparse_matrix_variable_block_create_float, or
|
|
1938
|
+
sparse_matrix_variable_block_create_double.
|
|
1939
|
+
|
|
1940
|
+
*/
|
|
1941
|
+
sparse_status sparse_extract_block_float( sparse_matrix_float A, sparse_index bi,
|
|
1942
|
+
sparse_index bj, sparse_dimension row_stride,
|
|
1943
|
+
sparse_dimension col_stride,
|
|
1944
|
+
float * __restrict val )
|
|
1945
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1946
|
+
|
|
1947
|
+
sparse_status sparse_extract_block_double( sparse_matrix_double A, sparse_index bi,
|
|
1948
|
+
sparse_index bj, sparse_dimension row_stride,
|
|
1949
|
+
sparse_dimension col_stride,
|
|
1950
|
+
double * __restrict val )
|
|
1951
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1952
|
+
|
|
1953
|
+
sparse_status sparse_extract_block_float_complex( sparse_matrix_float_complex A, sparse_index bi,
|
|
1954
|
+
sparse_index bj, sparse_dimension row_stride,
|
|
1955
|
+
sparse_dimension col_stride,
|
|
1956
|
+
float _Complex * __restrict val )
|
|
1957
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1958
|
+
|
|
1959
|
+
sparse_status sparse_extract_block_double_complex( sparse_matrix_double_complex A, sparse_index bi,
|
|
1960
|
+
sparse_index bj, sparse_dimension row_stride,
|
|
1961
|
+
sparse_dimension col_stride,
|
|
1962
|
+
double _Complex * __restrict val )
|
|
1963
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
1964
|
+
|
|
1965
|
+
/*!
|
|
1966
|
+
@abstract
|
|
1967
|
+
Return the dimension of the block for the i'th row of a sparse block matrix.
|
|
1968
|
+
Returns 0 if the matrix was not created with a block create routine.
|
|
1969
|
+
*/
|
|
1970
|
+
long sparse_get_block_dimension_for_row( void *A, sparse_index i )
|
|
1971
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1972
|
+
|
|
1973
|
+
/*!
|
|
1974
|
+
@abstract
|
|
1975
|
+
Return the dimension of the block for the j'th column of a sparse block matrix.
|
|
1976
|
+
Returns 0 if the matrix was not created with a block create routine.
|
|
1977
|
+
*/
|
|
1978
|
+
long sparse_get_block_dimension_for_col( void *A, sparse_index j )
|
|
1979
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
#pragma mark - General Sparse Matrix Management Routines -
|
|
1984
|
+
|
|
1985
|
+
/* General Sparse Matrix Management Routines */
|
|
1986
|
+
/*!
|
|
1987
|
+
@functiongroup General Sparse Matrix Management Routines
|
|
1988
|
+
@abstract Routines to manage and work with sparse matrix properties.
|
|
1989
|
+
*/
|
|
1990
|
+
|
|
1991
|
+
/*!
|
|
1992
|
+
@abstract
|
|
1993
|
+
Force any recently added values to the matrix to be put into the internal
|
|
1994
|
+
sparse storage format.
|
|
1995
|
+
|
|
1996
|
+
@param A
|
|
1997
|
+
The sparse matrix, which has had values recently inserted into the object.
|
|
1998
|
+
|
|
1999
|
+
@result
|
|
2000
|
+
On success, A has all values inserted into the internal sparse representation.
|
|
2001
|
+
|
|
2002
|
+
@discussion
|
|
2003
|
+
Force any recently added values to the matrix to be put into the internal
|
|
2004
|
+
sparse storage format. Values inserted into a matrix object will may not go
|
|
2005
|
+
directly into the sparse representation until needed, for example when a
|
|
2006
|
+
computation occurs. In some cases is may be beneficial to the caller to know
|
|
2007
|
+
when the cost of the update will occur. This routine allows the caller to
|
|
2008
|
+
trigger adding values to the internal sparse format.
|
|
2009
|
+
|
|
2010
|
+
Adding values to the sparse format can be costly, and batch updates to the
|
|
2011
|
+
matrices are recommended. Similarly, use of this routine may be expensive, so
|
|
2012
|
+
it is best to insert all values of a batch and call this routine once.
|
|
2013
|
+
|
|
2014
|
+
*/
|
|
2015
|
+
sparse_status sparse_commit( void *A )
|
|
2016
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
/*!
|
|
2020
|
+
@abstract
|
|
2021
|
+
Returns the value of the given property name.
|
|
2022
|
+
|
|
2023
|
+
@param A
|
|
2024
|
+
The sparse matrix object.
|
|
2025
|
+
|
|
2026
|
+
@param pname
|
|
2027
|
+
The property name to get the value of. See matrix properties enumeration for
|
|
2028
|
+
options.
|
|
2029
|
+
|
|
2030
|
+
@result
|
|
2031
|
+
Returns the value of the property for a valid object and property, or 0
|
|
2032
|
+
otherwise.
|
|
2033
|
+
|
|
2034
|
+
@discussion
|
|
2035
|
+
Returns the value of the given property name. See matrix properties enumeration
|
|
2036
|
+
for further property details.
|
|
2037
|
+
|
|
2038
|
+
*/
|
|
2039
|
+
long sparse_get_matrix_property( void *A, sparse_matrix_property pname )
|
|
2040
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2041
|
+
|
|
2042
|
+
/*!
|
|
2043
|
+
@abstract
|
|
2044
|
+
Set the given property for a matrix object that has not had any values
|
|
2045
|
+
inserted.
|
|
2046
|
+
|
|
2047
|
+
@param A
|
|
2048
|
+
The sparse matrix object. Note that after elements have been inserted
|
|
2049
|
+
properties cannot be changed.
|
|
2050
|
+
|
|
2051
|
+
@param pname
|
|
2052
|
+
The property name to set true. See matrix properties enumeration for options.
|
|
2053
|
+
|
|
2054
|
+
@result
|
|
2055
|
+
Returns SPARSE_SUCCESS when property is successfully set, otherwise return
|
|
2056
|
+
SPARSE_CANNOT_SET_PROPERTY.
|
|
2057
|
+
|
|
2058
|
+
@discussion
|
|
2059
|
+
Set the given property for the matrix object. The matrix object must not have
|
|
2060
|
+
had values inserted, else SPARSE_CANNOT_SET_PROPERTY is returned and the
|
|
2061
|
+
property is not set.
|
|
2062
|
+
|
|
2063
|
+
Certain groups of properties are mutually exclusive and setting multiple values
|
|
2064
|
+
within a group is undefined.
|
|
2065
|
+
|
|
2066
|
+
*/
|
|
2067
|
+
sparse_status sparse_set_matrix_property( void *A, sparse_matrix_property pname )
|
|
2068
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2069
|
+
|
|
2070
|
+
|
|
2071
|
+
/*!
|
|
2072
|
+
@abstract
|
|
2073
|
+
Return the number of rows of the matrix.
|
|
2074
|
+
*/
|
|
2075
|
+
sparse_dimension sparse_get_matrix_number_of_rows( void *A )
|
|
2076
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2077
|
+
|
|
2078
|
+
/*!
|
|
2079
|
+
@abstract
|
|
2080
|
+
Return the number of columns of the matrix.
|
|
2081
|
+
*/
|
|
2082
|
+
sparse_dimension sparse_get_matrix_number_of_columns( void *A )
|
|
2083
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2084
|
+
|
|
2085
|
+
/*!
|
|
2086
|
+
@abstract
|
|
2087
|
+
Return the number of nonzero values in the matrix.
|
|
2088
|
+
*/
|
|
2089
|
+
long sparse_get_matrix_nonzero_count( void *A )
|
|
2090
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2091
|
+
|
|
2092
|
+
/*!
|
|
2093
|
+
@abstract
|
|
2094
|
+
Return the number of nonzero values for the i'th row. If index is out of
|
|
2095
|
+
bounds of the matrix, 0 is returned.
|
|
2096
|
+
*/
|
|
2097
|
+
long sparse_get_matrix_nonzero_count_for_row( void *A, sparse_index i )
|
|
2098
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2099
|
+
|
|
2100
|
+
/*!
|
|
2101
|
+
@abstract
|
|
2102
|
+
Return the number of nonzero values for the j'th column. If index is out of
|
|
2103
|
+
bounds of the matrix, 0 is returned.
|
|
2104
|
+
*/
|
|
2105
|
+
long sparse_get_matrix_nonzero_count_for_column( void *A, sparse_index j )
|
|
2106
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
/*!
|
|
2111
|
+
@abstract
|
|
2112
|
+
Release any memory associated with the matrix object.
|
|
2113
|
+
|
|
2114
|
+
@param A
|
|
2115
|
+
The sparse matrix object.
|
|
2116
|
+
|
|
2117
|
+
@result
|
|
2118
|
+
All memory associated with the matrix object is released and returns
|
|
2119
|
+
SPARSE_SUCCESS.
|
|
2120
|
+
|
|
2121
|
+
@discussion
|
|
2122
|
+
Release any memory associated with the matrix object. Upon return the object
|
|
2123
|
+
is no longer valid and any use of the object is undefined.
|
|
2124
|
+
|
|
2125
|
+
*/
|
|
2126
|
+
sparse_status sparse_matrix_destroy( void *A )
|
|
2127
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
|
|
2132
|
+
#pragma mark - Sparse Utilities -
|
|
2133
|
+
/* Sparse Utility Routines */
|
|
2134
|
+
/*!
|
|
2135
|
+
@functiongroup Sparse Utilities
|
|
2136
|
+
@abstract Various utility routines for creating and working with sparse
|
|
2137
|
+
structures.
|
|
2138
|
+
*/
|
|
2139
|
+
|
|
2140
|
+
/*!
|
|
2141
|
+
@abstract
|
|
2142
|
+
Return the number of nonzero values in the dense vector x.
|
|
2143
|
+
|
|
2144
|
+
@param N
|
|
2145
|
+
The number of elements in the dense vector x.
|
|
2146
|
+
|
|
2147
|
+
@param x
|
|
2148
|
+
Pointer to the vector x.
|
|
2149
|
+
|
|
2150
|
+
@param incx
|
|
2151
|
+
Increment between valid values in the dense vector x. Negative strides are
|
|
2152
|
+
supported.
|
|
2153
|
+
|
|
2154
|
+
@result
|
|
2155
|
+
Return the count of the nonzero values in the vector x.
|
|
2156
|
+
|
|
2157
|
+
*/
|
|
2158
|
+
long sparse_get_vector_nonzero_count_float( sparse_dimension N,
|
|
2159
|
+
const float * __restrict x,
|
|
2160
|
+
sparse_stride incx )
|
|
2161
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2162
|
+
|
|
2163
|
+
long sparse_get_vector_nonzero_count_double( sparse_dimension N,
|
|
2164
|
+
const double * __restrict x,
|
|
2165
|
+
sparse_stride incx )
|
|
2166
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2167
|
+
|
|
2168
|
+
long sparse_get_vector_nonzero_count_float_complex( sparse_dimension N,
|
|
2169
|
+
const float _Complex * __restrict x,
|
|
2170
|
+
sparse_stride incx )
|
|
2171
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
2172
|
+
|
|
2173
|
+
long sparse_get_vector_nonzero_count_double_complex( sparse_dimension N,
|
|
2174
|
+
const double _Complex * __restrict x,
|
|
2175
|
+
sparse_stride incx )
|
|
2176
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
2177
|
+
|
|
2178
|
+
/*!
|
|
2179
|
+
@abstract
|
|
2180
|
+
Pack the first nz nonzero values and indices from the dense vector x and
|
|
2181
|
+
place them in y and indy.
|
|
2182
|
+
|
|
2183
|
+
@param N
|
|
2184
|
+
The number of elements in the dense vector x.
|
|
2185
|
+
|
|
2186
|
+
@param nz
|
|
2187
|
+
The number of nonzero values to collect. If less than nz nonzero elements are
|
|
2188
|
+
found in the N elements of x, then the last nz - actual_nonzero_count of y and
|
|
2189
|
+
indy are unused.
|
|
2190
|
+
|
|
2191
|
+
@param x
|
|
2192
|
+
Pointer to the dense vector x.
|
|
2193
|
+
|
|
2194
|
+
@param incx
|
|
2195
|
+
Increment between valid values in the dense vector x. Negative strides are
|
|
2196
|
+
supported.
|
|
2197
|
+
|
|
2198
|
+
@param y
|
|
2199
|
+
The destination dense storage for nonzero values of x. Expected to be of size
|
|
2200
|
+
nz elements. On return, any nonzero values are placed in this array, if the
|
|
2201
|
+
actual number of nonzero values is less than nz, then the last
|
|
2202
|
+
nz - actual_nonzero_count elements are unused.
|
|
2203
|
+
|
|
2204
|
+
@param indy
|
|
2205
|
+
The destination dense storage for nonzero indices of x. Expected to be of size
|
|
2206
|
+
nz elements. On return, any nonzero indices are placed in this array, if the
|
|
2207
|
+
actual number of nonzero values is less than nz, then the last
|
|
2208
|
+
nz - actual_nonzero_count elements are unused. Returned indices are 0 based
|
|
2209
|
+
(the first element of a pointer is ptr[0]).
|
|
2210
|
+
|
|
2211
|
+
@result
|
|
2212
|
+
On success, y and indy are updated with up to the first nz nonzero indices.
|
|
2213
|
+
The number of nonzero values written is returned.
|
|
2214
|
+
|
|
2215
|
+
@discussion
|
|
2216
|
+
Pack the first nz nonzero values and indices from the dense vector x and
|
|
2217
|
+
place them in y and indy. If less than nz nonzero elements are found in the N
|
|
2218
|
+
elements of x, then the last nz - actual_nonzero_count elements of y and indy
|
|
2219
|
+
are unused. The number of indices written can range from 0 to nz values and
|
|
2220
|
+
the number written is returned.
|
|
2221
|
+
|
|
2222
|
+
*/
|
|
2223
|
+
long sparse_pack_vector_float( sparse_dimension N, sparse_dimension nz,
|
|
2224
|
+
const float * __restrict x,
|
|
2225
|
+
sparse_stride incx, float * __restrict y,
|
|
2226
|
+
sparse_index * __restrict indy )
|
|
2227
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2228
|
+
|
|
2229
|
+
long sparse_pack_vector_double( sparse_dimension N, sparse_dimension nz,
|
|
2230
|
+
const double * __restrict x,
|
|
2231
|
+
sparse_stride incx, double * __restrict y,
|
|
2232
|
+
sparse_index * __restrict indy )
|
|
2233
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2234
|
+
|
|
2235
|
+
long sparse_pack_vector_float_complex( sparse_dimension N, sparse_dimension nz,
|
|
2236
|
+
const float _Complex * __restrict x,
|
|
2237
|
+
sparse_stride incx, float _Complex * __restrict y,
|
|
2238
|
+
sparse_index * __restrict indy )
|
|
2239
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
2240
|
+
|
|
2241
|
+
long sparse_pack_vector_double_complex( sparse_dimension N, sparse_dimension nz,
|
|
2242
|
+
const double _Complex * __restrict x,
|
|
2243
|
+
sparse_stride incx, double _Complex * __restrict y,
|
|
2244
|
+
sparse_index * __restrict indy )
|
|
2245
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
2246
|
+
|
|
2247
|
+
/*!
|
|
2248
|
+
@abstract
|
|
2249
|
+
Extract elements from the sparse vector x into the corresponding location in
|
|
2250
|
+
the dense vector y. Optionally zero the unused values of y.
|
|
2251
|
+
|
|
2252
|
+
@param N
|
|
2253
|
+
The number of elements in the dense vector y.
|
|
2254
|
+
|
|
2255
|
+
@param nz
|
|
2256
|
+
The number of nonzero entries in the sparse vector x.
|
|
2257
|
+
|
|
2258
|
+
@param zero
|
|
2259
|
+
When true, zero the elements of y which do not have nonzero values written to
|
|
2260
|
+
them. When false ignore the elements of y which do not have nonzero values
|
|
2261
|
+
written to them.
|
|
2262
|
+
|
|
2263
|
+
@param x
|
|
2264
|
+
Pointer to the dense storage for the values of the sparse vector x. The
|
|
2265
|
+
corresponding entry in indx holds the index of the value. Contains nz values.
|
|
2266
|
+
|
|
2267
|
+
@param indx
|
|
2268
|
+
Pointer to the dense storage for the index values of the sparse vector x. The
|
|
2269
|
+
corresponding entry in x holds the values of the vector. Contains nz values.
|
|
2270
|
+
|
|
2271
|
+
Indices are always assumed to be stored in ascending order. Additionally,
|
|
2272
|
+
indices are assumed to be unique. Undefined behavior if either of these
|
|
2273
|
+
assumptions are not met.
|
|
2274
|
+
|
|
2275
|
+
All indices are 0 based (the first element of a pointer is ptr[0]).
|
|
2276
|
+
|
|
2277
|
+
@param y
|
|
2278
|
+
Pointer to the dense vector y. Expected to be of size N*abs(incy) elements.
|
|
2279
|
+
Negative strides are supported. Note, unlike dense BLAS routines, the pointer
|
|
2280
|
+
points to the last element when stride is negative. On exit, the entries
|
|
2281
|
+
described by the indices in indx will be filled with the corresponding values
|
|
2282
|
+
in x and all other values will be unchanged if parameter zero is false, or set
|
|
2283
|
+
to zero if parameter zero is true.
|
|
2284
|
+
|
|
2285
|
+
@param incy
|
|
2286
|
+
Increment between valid values in the dense vector y. Negative strides are
|
|
2287
|
+
supported.
|
|
2288
|
+
|
|
2289
|
+
@result
|
|
2290
|
+
On exit y has been updated with the nonzero values. If nz is less than or
|
|
2291
|
+
equal to zero y is unchanged.
|
|
2292
|
+
|
|
2293
|
+
@discussion
|
|
2294
|
+
Extract elements from the sparse vector x into the corresponding location in
|
|
2295
|
+
the dense vector y. Optionally zero the unused values of y.
|
|
2296
|
+
|
|
2297
|
+
if (zero) for (i in 0 .. N-1) y[i*incy] = 0;
|
|
2298
|
+
|
|
2299
|
+
for (i in 0 .. nz-1) if (indx[i] < N) y[indx[i]*incy] = x[i];
|
|
2300
|
+
*/
|
|
2301
|
+
void sparse_unpack_vector_float( sparse_dimension N, sparse_dimension nz, bool zero,
|
|
2302
|
+
const float * __restrict x,
|
|
2303
|
+
const sparse_index * __restrict indx,
|
|
2304
|
+
float * __restrict y, sparse_stride incy )
|
|
2305
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2306
|
+
|
|
2307
|
+
void sparse_unpack_vector_double( sparse_dimension N, sparse_dimension nz, bool zero,
|
|
2308
|
+
const double * __restrict x,
|
|
2309
|
+
const sparse_index * __restrict indx,
|
|
2310
|
+
double * __restrict y, sparse_stride incy )
|
|
2311
|
+
API_AVAILABLE(macos(10.11), ios(9.0), watchos(3.0), tvos(9.0));
|
|
2312
|
+
|
|
2313
|
+
void sparse_unpack_vector_float_complex( sparse_dimension N, sparse_dimension nz, bool zero,
|
|
2314
|
+
const float _Complex * __restrict x,
|
|
2315
|
+
const sparse_index * __restrict indx,
|
|
2316
|
+
float _Complex * __restrict y, sparse_stride incy )
|
|
2317
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
2318
|
+
|
|
2319
|
+
void sparse_unpack_vector_double_complex( sparse_dimension N, sparse_dimension nz, bool zero,
|
|
2320
|
+
const double _Complex * __restrict x,
|
|
2321
|
+
const sparse_index * __restrict indx,
|
|
2322
|
+
double _Complex * __restrict y, sparse_stride incy )
|
|
2323
|
+
API_AVAILABLE(macos(15.5), ios(18.5), watchos(11.5), tvos(18.5));
|
|
2324
|
+
|
|
2325
|
+
#ifdef __cplusplus
|
|
2326
|
+
}
|
|
2327
|
+
#endif
|
|
2328
|
+
|
|
2329
|
+
#endif
|
|
2330
|
+
/* __SPARSE_BLAS_H */
|