public class LazyDataset extends LazyDatasetBase implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
protected int[] |
begSlice |
protected int[] |
delSlice |
protected int |
isize |
protected ILazyLoader |
loader |
protected int[] |
map |
protected Map<Class<? extends MetadataType>,List<MetadataType>> |
oMetadata |
protected int[] |
oShape |
protected int[] |
padding |
protected long |
size |
protected int[] |
sShape |
metadata, name, shape
Constructor and Description |
---|
LazyDataset(ILazyLoader loader,
String name,
Class<? extends Dataset> clazz,
int... shape)
Create a lazy dataset
|
LazyDataset(ILazyLoader loader,
String name,
int elements,
Class<? extends Dataset> clazz,
int... shape)
Create a lazy dataset
|
LazyDataset(String name,
int dtype,
int[] shape,
ILazyLoader loader)
Deprecated.
|
LazyDataset(String name,
int dtype,
int elements,
int[] shape,
ILazyLoader loader)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected SliceND |
calcTrueSlice(SliceND slice)
Calculate absolute slice
|
LazyDataset |
clone()
Clone dataset
|
static LazyDataset |
createLazyDataset(Dataset dataset)
Create a lazy dataset based on in-memory data (handy for testing)
|
protected SliceND |
createSlice(int[] nstart,
int[] nstop,
int[] nstep) |
boolean |
equals(Object obj) |
int |
getDType()
Can return -1 when dataset interface is not defined
|
Class<?> |
getElementClass() |
int |
getElementsPerItem()
Can return -1 for unknown
|
Class<? extends Dataset> |
getInterface() |
static int |
getMaxSliceLength(ILazyDataset lazySet,
int dimension)
Gets the maximum size of a slice of a dataset in a given dimension
which should normally fit in memory.
|
int |
getSize()
The size of the dataset is the number of items in the array
|
Dataset |
getSlice(IMonitor monitor,
int[] start,
int[] stop,
int[] step)
Get a slice of the dataset.
|
Dataset |
getSlice(IMonitor monitor,
Slice... slice)
Get a slice of the dataset.
|
Dataset |
getSlice(IMonitor monitor,
SliceND slice)
Get a slice of the dataset.
|
Dataset |
getSlice(int[] start,
int[] stop,
int[] step)
Get a slice of the dataset.
|
Dataset |
getSlice(Slice... slice)
Get a slice of the dataset.
|
Dataset |
getSlice(SliceND slice)
Get a slice of the dataset.
|
LazyDataset |
getSliceView(int[] start,
int[] stop,
int[] step)
Get a slice of the dataset.
|
LazyDataset |
getSliceView(Slice... slice)
Get a slice of the dataset.
|
LazyDataset |
getSliceView(SliceND slice)
Get a slice of the dataset.
|
LazyDataset |
getTransposedView(int... axes)
Permute copy of dataset's axes so that given order is old order:
|
int |
hashCode() |
protected Dataset |
internalGetSlice(IMonitor monitor,
SliceND slice) |
protected LazyDataset |
internalGetSliceView(SliceND slice) |
void |
setInterface(Class<? extends Dataset> clazz)
Set interface
|
void |
setShape(int... shape)
Set a compatible shape for dataset.
|
LazyDataset |
squeezeEnds()
Remove dimensions of 1 from ends of shape of the dataset
|
String |
toString() |
addMetadata, checkPermutatedAxes, checkSliceND, clearMetadata, copyMetadata, copyMetadata, createFromSerializable, dirtyMetadata, findMetadataTypeSubInterfaces, getErrorMetadata, getErrors, getFirstMetadata, getMetadata, getMetadata, getMetadataMap, getName, getRank, getShape, hasErrors, reshapeMetadata, restoreMetadata, setDirty, setErrors, setMetadata, setName, sliceMetadata, transposeMetadata
protected Map<Class<? extends MetadataType>,List<MetadataType>> oMetadata
protected int[] oShape
protected long size
protected int isize
protected ILazyLoader loader
protected int[] begSlice
protected int[] delSlice
protected int[] sShape
protected int[] padding
protected int[] map
public LazyDataset(ILazyLoader loader, String name, int elements, Class<? extends Dataset> clazz, int... shape)
loader
- lazy loadername
- of datasetelements
- item sizeclazz
- dataset sub-interfaceshape
- dataset shapepublic LazyDataset(ILazyLoader loader, String name, Class<? extends Dataset> clazz, int... shape)
loader
- lazy loadername
- of datasetclazz
- dataset sub-interfaceshape
- dataset shape@Deprecated public LazyDataset(String name, int dtype, int elements, int[] shape, ILazyLoader loader)
LazyDataset(ILazyLoader, String, int, Class, int[])
name
- of datasetdtype
- dataset typeelements
- item sizeshape
- dataset shapeloader
- lazy loader@Deprecated public LazyDataset(String name, int dtype, int[] shape, ILazyLoader loader)
LazyDataset(ILazyLoader, String, int, Class, int[])
name
- of datasetdtype
- dataset typeshape
- dataset shapeloader
- lazy loaderpublic static LazyDataset createLazyDataset(Dataset dataset)
dataset
- inputpublic Class<?> getElementClass()
getElementClass
in interface ILazyDataset
public int getDType()
getDType
in class LazyDatasetBase
public Class<? extends Dataset> getInterface()
public void setInterface(Class<? extends Dataset> clazz)
clazz
- dataset sub-interfacepublic int getElementsPerItem()
getElementsPerItem
in interface ILazyDataset
public int getSize()
ILazyDataset
getSize
in interface ILazyDataset
public int hashCode()
hashCode
in class LazyDatasetBase
public boolean equals(Object obj)
equals
in class LazyDatasetBase
public LazyDataset clone()
ILazyDataset
clone
in interface ILazyDataset
clone
in class LazyDatasetBase
public void setShape(int... shape)
ILazyDataset
setShape
in interface ILazyDataset
shape
- to setpublic LazyDataset squeezeEnds()
ILazyDataset
squeezeEnds
in interface ILazyDataset
public Dataset getSlice(int[] start, int[] stop, int[] step) throws DatasetException
ILazyDataset
getSlice
in interface ILazyDataset
start
- specifies the starting indexes (can be null for origin)stop
- specifies the stopping indexes (can be null for end)step
- specifies the steps in the slice (can be null for unit steps)DatasetException
- when cannot retrieve slice of lazy datasetpublic Dataset getSlice(Slice... slice) throws DatasetException
ILazyDataset
getSlice
in interface ILazyDataset
slice
- an array of slice objects (the array can be null or contain nulls)DatasetException
- when cannot retrieve slice of lazy datasetpublic Dataset getSlice(SliceND slice) throws DatasetException
ILazyDataset
getSlice
in interface ILazyDataset
slice
- an n-D sliceDatasetException
- when cannot retrieve slice of lazy datasetpublic Dataset getSlice(IMonitor monitor, Slice... slice) throws DatasetException
ILazyDataset
getSlice
in interface ILazyDataset
monitor
- can be nullslice
- an array of slice objects (the array can be null or contain nulls)DatasetException
- when cannot retrieve slice of lazy datasetpublic LazyDataset getSliceView(Slice... slice)
ILazyDataset
getSliceView
in interface ILazyDataset
slice
- an array of slice objects (the array can be null or contain nulls)public LazyDataset getSliceView(int[] start, int[] stop, int[] step)
ILazyDataset
getSliceView
in interface ILazyDataset
start
- specifies the starting indexes (can be null for origin)stop
- specifies the stopping indexes (can be null for end)step
- specifies the steps in the slice (can be null for unit steps)public LazyDataset getSliceView(SliceND slice)
ILazyDataset
getSliceView
in interface ILazyDataset
slice
- an n-D sliceprotected LazyDataset internalGetSliceView(SliceND slice)
public Dataset getSlice(IMonitor monitor, int[] start, int[] stop, int[] step) throws DatasetException
ILazyDataset
getSlice
in interface ILazyDataset
monitor
- can be nullstart
- specifies the starting indexes (can be null for origin)stop
- specifies the stopping indexes (can be null for end)step
- specifies the steps in the slice (can be null for unit steps)DatasetException
- when cannot retrieve slice of lazy datasetpublic Dataset getSlice(IMonitor monitor, SliceND slice) throws DatasetException
ILazyDataset
getSlice
in interface ILazyDataset
monitor
- can be nullslice
- an n-D sliceDatasetException
- when cannot retrieve slice of lazy datasetprotected Dataset internalGetSlice(IMonitor monitor, SliceND slice) throws DatasetException
DatasetException
public LazyDataset getTransposedView(int... axes)
ILazyDataset
axisPerm = (p(0), p(1),...) => newdata(n(0), n(1),...) = olddata(o(0), o(1), ...) such that n(i) = o(p(i)) for all iI.e. for a 3D dataset (1,0,2) implies the new dataset has its 1st dimension running along the old dataset's 2nd dimension and the new 2nd is the old 1st. The 3rd dimension is left unchanged.
getTransposedView
in interface ILazyDataset
axes
- if zero length then axes order reversedprotected final SliceND calcTrueSlice(SliceND slice)
slice
- an n-D sliceprotected SliceND createSlice(int[] nstart, int[] nstop, int[] nstep)
public static int getMaxSliceLength(ILazyDataset lazySet, int dimension)
lazySet
- lazy datasetdimension
- to slice alongCopyright © 2014–2022 Eclipse Foundation. All rights reserved.