Package mklab.JGNN.core.matrix
Class WrapRows
java.lang.Object
mklab.JGNN.core.Tensor
mklab.JGNN.core.Matrix
mklab.JGNN.core.matrix.WrapRows
Wraps a list of tensors into a matrix with the tensors as rows.
 Does not allocate additional elements. Editing the matrix edits
 the original tensors and conversely.
 
- Author:
- Emmanouil Krasanakis
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classprotected class
- 
Field SummaryFields inherited from class mklab.JGNN.core.Tensorvectorization
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaccessRow(long row) Retrieves the given row as a tensor.protected voidallocate(long size) longProvides an estimation for the non-zero number of elements stored in the tensor, where this number is equal to the size for dense tensors, but equal to the actual number of non-zero elements for sparse tensors.doubleget(long pos) Retrieves the value of a tensor element at a given position.Retrieves an iterable that traverses (row, col) entry pairs of non zero entries.voidpersist()If supported by the subclassed tensor, invalidates calls toTensor.release()so that memory is de-allocated only when object references expire.put(long pos, double value) Assign a value to a tensor element.voidrelease()If the subclassed tensor allows it, release all memory it takes up so that the garbage collector will eventually clean it up.setZeroCopyType(Matrix zeroCopyType) Sets a prototype matrix from which to borrow copying operations.Retrieves positions within the tensor that may hold non-zero elements.zeroCopy(long rows, long cols) Creates a matrix of the same class and all element set to zero, but with a given number of rows and columns.Methods inherited from class mklab.JGNN.core.MatrixaccessCol, accessColumns, accessColumns, accessColumns, accessColumns, accessDim, accessRows, accessRows, accessRows, accessRows, asTransposed, describe, determineZeroCopy, external, eye, fromDouble, get, getColName, getCols, getDimensionSize, getRowName, getRows, isMatching, matmul, matmul, onesMask, put, setColName, setDiagonal, setDimensionName, setDimensionName, setMainDiagonal, setRowName, setToASymmetricNormalization, setToSymmetricNormalization, symmetricNormalization, toDense, toNonZeroString, toSparse, toString, transform, transposed, zeroCopy, zeroCopy, zeroCopyMethods inherited from class mklab.JGNN.core.Tensorabs, accessSubtensor, accessSubtensor, add, add, argmax, argmin, asColumn, asRow, assertFinite, assertMatching, assertSize, assign, cast, copy, density, determineZeroCopy, dot, dot, expMinusOne, fromRange, fromRange, getDimensionName, getNonZeroElements, init, inverse, iterator, log, max, min, multiply, multiply, negative, norm, normalized, putAdd, selfAbs, selfAdd, selfAdd, selfAdd, selfExpMinusOne, selfInverse, selfLog, selfMultiply, selfMultiply, selfNegative, selfSqrt, selfSubtract, setDimensionName, setToNormalized, setToOnes, setToProbability, setToRandom, setToRandom, setToUniform, setToZero, size, sqrt, subtract, sum, toArray, toDouble, toProbabilityMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
WrapRows
- 
WrapRows
 
- 
- 
Method Details- 
estimateNumNonZeroElementspublic long estimateNumNonZeroElements()Description copied from class:TensorProvides an estimation for the non-zero number of elements stored in the tensor, where this number is equal to the size for dense tensors, but equal to the actual number of non-zero elements for sparse tensors. Basically, this quantity is proportional to the allocated memory.- Overrides:
- estimateNumNonZeroElementsin class- Tensor
- Returns:
- A long number equal to or less to the tensor size.
- See Also:
 
- 
setZeroCopyTypeSets a prototype matrix from which to borrow copying operations.- Parameters:
- zeroCopyType- A- Matrixinstance from which to borrow- zeroCopy(long, long).
- Returns:
- thisobject
 
- 
zeroCopyDescription copied from class:MatrixCreates a matrix of the same class and all element set to zero, but with a given number of rows and columns.
- 
allocateprotected void allocate(long size) 
- 
putDescription copied from class:TensorAssign a value to a tensor element. All tensor operations use this function to wrap element assignments.
- 
getpublic double get(long pos) Description copied from class:TensorRetrieves the value of a tensor element at a given position. All tensor operations use this function to wrap element retrieval.
- 
traverseNonZeroElementsDescription copied from class:TensorRetrieves positions within the tensor that may hold non-zero elements. This guarantees that all non-zero elements positions are traversed but some of the returned positions could hold zero elements. For example,DenseTensortraverses all of its elements this way, whereasSparseTensorindeed traverses only non-zero elements.- Specified by:
- traverseNonZeroElementsin class- Tensor
- Returns:
- An iterator that traverses positions within the tensor.
 
- 
getNonZeroEntriesDescription copied from class:MatrixRetrieves an iterable that traverses (row, col) entry pairs of non zero entries.- Specified by:
- getNonZeroEntriesin class- Matrix
- Returns:
- An Entry iterable.
- See Also:
 
- 
accessRowDescription copied from class:MatrixRetrieves the given row as a tensor. Editing the result also edits the original matrix. No new memory is allocated for matrix values.
- 
releasepublic void release()Description copied from class:TensorIf the subclassed tensor allows it, release all memory it takes up so that the garbage collector will eventually clean it up. This memory will be released anyway by Java once there are no more references to the object.
- 
persistpublic void persist()Description copied from class:TensorIf supported by the subclassed tensor, invalidates calls toTensor.release()so that memory is de-allocated only when object references expire.
 
-