# cwise **Repository Path**: mirrors_taoqf/cwise ## Basic Information - **Project Name**: cwise - **Description**: Component-wise operations for ndarrays - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-26 - **Last Updated**: 2026-03-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README cwise ===== This library can be used to generate cache efficient map/reduce operations for [ndarrays](http://github.com/mikolalysenko/ndarray). [![build status](https://secure.travis-ci.org/scijs/cwise.png)](http://travis-ci.org/scijs/cwise) # Examples For brevity, we will assume the following precedes each example: ```javascript //Import libraries var cwise = require("cwise") , ndarray = require("ndarray") ``` ## Adding two arrays The array equivalent of `+=`: ```javascript //Create operation var addeq = cwise({ args: ["array", "array"], body: function(a, b) { a += b } }) //Create two 2D arrays var X = ndarray(new Float32Array(128*128), [128,128]) var Y = ndarray(new Float32Array(128*128), [128,128]) //Add them together addeq(X, Y) ``` Formally, you can think of `addeq(X,Y)` as being something like the following for-loop, except optimized with respect to the dimension and order of X and Y: ```javascript for(var i=0; i