REPOP -- efficient replicating n-d array operations

版本 1.3.1.0 (45.7 KB) 作者: Jason Farquhar
REPOP -- any element-wise operator between different sized n-d matrices without memory copies
760.0 次下载
更新 2021/11/17

repop

auto replicating operators in matlab

Replicating arithmetical and logical operators.

Does element by element operations on X and Y where non-same sized dimensions are implicity wrapped round to match the size of the larger to give a result matrix Z with size max(size(X),size(Y));

In general this is at least 2x faster than the equivalent matlab code using repmats and has the advantage of requiring no additional memory.

Example Usage:

X = randn(10000,10); example signal with data in rows

stdX = repop(X,mean(X,1),'-'); subtract the mean vector

stdX = repop(stdX,std(stdX,0,1),'/'); % divide by std-deviation

Operator can be one of:

Arthemetical -- returns a double matrix

'+','.+',plus - Implicitly repmatted elementwise addition

'-','.-',minus - Implicitly repmatted elementwise addition

'','.',times - Implicitly repmatted elementwise multiplication

'^','.^',power - Implicitly repmatted elementwise raise X to power Y

'','.',ldivide- Implicitly repmatted elementwise divide Y by X

'/','./',rdivide- Implicitly repmatted elementwise divide X by Y

Relational -- returns a logical matrix

N.B. for complex inputs the <,>,<=,>= operators are based upon abs(x) (not real(x) as in matlab)

'==',eq - Implicitly repmatted elementwise equality

'~=',ne - Implicitly repmatted elementwise dis-equality

'<' ,lt - Implicitly repmatted elementwise less than

'>' ,gt - Implicitly repmatted elementwise greater than

'<=',le - Implicitly repmatted elementwise less than equal

'>=',ge - Implicitly repmatted elementwise greater than equal

引用格式

Jason Farquhar (2026). REPOP -- efficient replicating n-d array operations (https://github.com/jadref/repop/releases/tag/1.3.1.0), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2021b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Logical (Boolean) Operations 的更多信息
版本 已发布 发行说明
1.3.1.0

See release notes for this release on GitHub: https://github.com/jadref/repop/releases/tag/1.3.1.0

1.3.0.0

bug fix update

1.2.0.0

Fixed bug with the repop(x,'op',y) calling convention

1.1.0.0

Some minor code updates to make build better with 64bit macs.

1.0.0.0

bug fixes to memory management errors
added mod,min,max to the set of operators

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 存储库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 存储库