Skip to content

Add overloaded prod method #4

@marcsous

Description

@marcsous

Hi Dylan,

A little bug, invalid imaginary index input not detected:

>> a=MappedTensor(1);
>> a(i)=1
Error using MappedTensor>ConvertColonsCheckLims (line 1861)
*** MappedTensor: Index exceeds matrix dimensions.
Error in MappedTensor>mt_write_data (line 1715)
   [vnLinearIndices, vnDataSize] = ConvertColonsCheckLims(sSubs.subs,
   vnTensorSize, hRepSumFunc);
Error in MappedTensor/subsasgn (line 503)
            mt_write_data(mtVar.hShimFunc, mtVar.hRealContent, subs,
            mtVar.vnOriginalSize, mtVar.strClass, mtVar.nHeaderBytes, tfData ./
            mtVar.fRealFactor, mtVar.bBigEndian, mtVar.hRepSumFunc,
            mtVar.hChunkLengthFunc); 

Also I wonder if you would consider adding these utility functions?

length
ndims
mean
prod
isfloat
isinteger

>> a=MappedTensor(1,'class','single');
>> isfloat(a)
ans =
     0
>> a=MappedTensor(1,'class','int8');
>> isinteger(a)
ans =
     0

Also, would you consider setting properties (SetAccess = private, GetAccess = public) so we can see the internals of the class using details() function?

Last thing, this is a little tricky, what should MappedTensor return for class()? Should it be of the contained values (single, double, int8, etc.)? I'm asking since a lot of (my) code checks for class and so MappedTensors require extra handling.

Thanks for your help!
Mark

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions