This class offers different performance trade-offs than the {@link AtomicGrowingSparseMatrix}. Specifically, this class supports concurrent write access to the same row. Atomicity is localized to the specific matrix entry, which ensures high concurrency for workloads consisting primarily of {@code get}, {@code addAndGet}, {@code getAndAdd} and {@code set}. This performance comes at a cost for the full row- or column-related operations. Each time these operations are used after a modification to the matrix, a full {@code O(m * n)} computation must be done to determine the structure ofthe matrix. An subsequent calls until the next modification will not incur this penalty and will operate in {@code O(k)} where {@code k} is the numberof non-zero entries in the row or column. It is therefore highly recommended that vector method be used only during periods when the matrix is not likely to be modified.
This class also provides support for access the matrix data without ensuring data coherency (i.e. non-atomic) through the {@link #getRowVectorUnsafe(int)}and {@link #getColumnVectorUnsafe(int)} methods. These methods are designedto be used only in circumstances where the matrix is guaranteed to only be accessed by one thread. In such circumstances, the overhead of locking row or column data can be avoided with no side-effects. Use these methods with great caution.
@author David Jurgens @see AtomicGrowingSparseMatrix @see Matrices#synchronizedMatrix(Matrix)
|
|
|
|
|
|