Sha256: 9d8b6a77a85156db75ca7accc19784d7729db9a70f6bb3f763f307e38fe83f78

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 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;
}

} // end of extern "C" block

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nmatrix-0.0.5 ext/nmatrix/storage/common.cpp
nmatrix-0.0.4 ext/nmatrix/storage/common.cpp