Sha256: a30ce4641d4c70ae6279fa555406bc61b8339fa9ffa13bcfa3bd1ea97412ab49
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 KB
Contents
///////////////////////////////////////////////////////////////////// // = NMatrix // // A linear algebra library for scientific computation in Ruby. // NMatrix is part of SciRuby. // // NMatrix was originally inspired by and derived from NArray, by // Masahiro Tanaka: http://narray.rubyforge.org // // == Copyright Information // // SciRuby is Copyright (c) 2010 - 2013, Ruby Science Foundation // NMatrix is Copyright (c) 2013, Ruby Science Foundation // // Please see LICENSE.txt for additional copyright notices. // // == Contributing // // By contributing source code to SciRuby, you agree to be bound by // our Contributor Agreement: // // * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement // // == common.cpp // // Code for the STORAGE struct that is common to all storage types. /* * Standard Includes */ /* * Project Includes */ #include "common.h" /* * Macros */ /* * Global Variables */ /* * Forward Declarations */ /* * Functions */ extern "C" { /* * Calculate the number of elements in the dense storage structure, based on * shape and dim. */ size_t nm_storage_count_max_elements(const STORAGE* storage) { unsigned int i; size_t count = 1; for (i = storage->dim; i-- > 0;) { count *= storage->shape[i]; } return count; } // Helper function used only for the RETURN_SIZED_ENUMERATOR macro. Returns the length of // the matrix's storage. VALUE nm_enumerator_length(VALUE nmatrix) { long len = nm_storage_count_max_elements(NM_STORAGE_DENSE(nmatrix)); return LONG2NUM(len); } } // end of extern "C" block
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nmatrix-0.0.9 | ext/nmatrix/storage/common.cpp |
nmatrix-0.0.8 | ext/nmatrix/storage/common.cpp |
nmatrix-0.0.7 | ext/nmatrix/storage/common.cpp |
nmatrix-0.0.6 | ext/nmatrix/storage/common.cpp |