Class MatrixObject
java.lang.Object
org.apache.sysds.runtime.instructions.cp.Data
org.apache.sysds.runtime.controlprogram.caching.CacheableData<MatrixBlock>
org.apache.sysds.runtime.controlprogram.caching.MatrixObject
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MatrixObjectFuture
Represents a matrix in control program. This class contains method to read matrices from HDFS and convert them to a
specific format/representation. It is also able to write several formats/representation of matrices to HDFS.
IMPORTANT: Preserve one-to-one correspondence between
MatrixObject and MatrixBlock objects, for cache
purposes. Do not change a MatrixBlock object without informing its MatrixObject object.- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.sysds.runtime.controlprogram.caching.CacheableData
CacheableData.CacheStatus -
Field Summary
Fields inherited from class org.apache.sysds.runtime.controlprogram.caching.CacheableData
cacheEvictionLocalFilePath, cacheEvictionLocalFilePrefix, CACHING_ASYNC_FILECLEANUP, CACHING_ASYNC_SERIALIZE, CACHING_BUFFER_POLICY, CACHING_COUNTER_GROUP_NAME, CACHING_EVICTION_FILEEXTENSION, CACHING_THRESHOLD -
Constructor Summary
ConstructorsConstructorDescriptionMatrixObject(Types.ValueType vt, String file) Constructor that takes the value type and the HDFS filename.MatrixObject(Types.ValueType vt, String file, MetaData mtd) Constructor that takes the value type, HDFS filename and associated metadata.MatrixObject(Types.ValueType vt, String file, MetaData mtd, MatrixBlock data) Constructor that takes the value type, HDFS filename and associated metadata and a MatrixBlock used for creation after serializationCopy constructor that copies meta data but NO data. -
Method Summary
Modifier and TypeMethodDescriptionintlonggetNnz()getPartitionFileName(IndexRange pred, int blen) intdoublebooleanbooleanisDiag()booleanisMarked()booleanNOTE: for reading matrix partitions, we could cache (in its real sense) the read block with soft references (no need for eviction, as partitioning only applied for read-only matrices).voidMake the matrix metadata consistent with the in-memory matrix datavoidsetDiag(boolean diag) voidsetInMemoryPartition(MatrixBlock block) voidsetMarkForLinCache(boolean mark) voidsetPartitioned(ParForProgramBlock.PDataPartitionFormat format, int n) voidtoString()voidvoidMethods inherited from class org.apache.sysds.runtime.controlprogram.caching.CacheableData
acquireModify, acquireRead, acquireReadAndRelease, addBroadcastSize, cleanupCacheDir, cleanupCacheDir, clearData, clearData, disableCaching, enableCaching, enableCleanup, exportData, exportData, exportData, exportData, exportData, freeEvictedBlob, getBroadcastHandle, getBroadcastSize, getCacheLineage, getCompressedSize, getDataCharacteristics, getDataSize, getDebugName, getDim, getFedMapping, getFileFormatProperties, getFileName, getGPUObject, getMetaData, getNumColumns, getNumRows, getRDDHandle, getStatus, getStreamable, getStreamHandle, getUniqueID, hasBroadcastHandle, hasRDDHandle, hasStreamHandle, hasValidLineage, initCaching, initCaching, isBelowCachingThreshold, isCached, isCachingActive, isCleanupEnabled, isDeviceToHostCopy, isDirty, isFederated, isFederated, isFederatedExcept, isHDFSFileExists, isPendingRDDOps, isPersistentRead, moveData, release, removeGPUObject, removeMetaData, setBroadcastHandle, setCacheLineage, setCompressedSize, setDirty, setEmptyStatus, setFedMapping, setFileFormatProperties, setFileName, setGPUObject, setHDFSFileExists, setMetaData, setPersistentRead, setRDDHandle, setStreamHandle, toStringMethods inherited from class org.apache.sysds.runtime.instructions.cp.Data
getDataType, getValueType
-
Constructor Details
-
MatrixObject
Constructor that takes the value type and the HDFS filename.- Parameters:
vt- value typefile- file name
-
MatrixObject
Constructor that takes the value type, HDFS filename and associated metadata.- Parameters:
vt- value typefile- file namemtd- metadata
-
MatrixObject
Constructor that takes the value type, HDFS filename and associated metadata and a MatrixBlock used for creation after serialization- Parameters:
vt- value typefile- file namemtd- metadatadata- matrix block data
-
MatrixObject
Copy constructor that copies meta data but NO data.- Parameters:
mo- matrix object
-
-
Method Details
-
setUpdateType
-
getUpdateType
-
isDiag
public boolean isDiag() -
setDiag
public void setDiag(boolean diag) -
setMarkForLinCache
public void setMarkForLinCache(boolean mark) -
isMarked
public boolean isMarked() -
updateDataCharacteristics
- Overrides:
updateDataCharacteristicsin classData
-
refreshMetaData
public void refreshMetaData()Make the matrix metadata consistent with the in-memory matrix data- Specified by:
refreshMetaDatain classCacheableData<MatrixBlock>
-
getBlocksize
public int getBlocksize()- Overrides:
getBlocksizein classCacheableData<MatrixBlock>
-
getNnz
public long getNnz() -
getSparsity
public double getSparsity() -
setPartitioned
-
unsetPartitioned
public void unsetPartitioned() -
isPartitioned
public boolean isPartitioned() -
getPartitionFormat
-
getPartitionSize
public int getPartitionSize() -
setInMemoryPartition
-
readMatrixPartition
NOTE: for reading matrix partitions, we could cache (in its real sense) the read block with soft references (no need for eviction, as partitioning only applied for read-only matrices). However, since we currently only support row- and column-wise partitioning caching is not applied yet. This could be changed once we also support column-block-wise and row-block-wise. Furthermore, as we reject to partition vectors and support only full row or column indexing, no metadata (apart from the partition flag) is required.- Parameters:
pred- index range- Returns:
- matrix block
-
getPartitionFileName
-
isCompressed
public boolean isCompressed()- Overrides:
isCompressedin classCacheableData<MatrixBlock>
-
toString
- Overrides:
toStringin classCacheableData<MatrixBlock>
-