Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

R3.0.0 is relased

4.660 Aufrufe

Veröffentlicht am

  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download Full doc Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download PDF EBOOK here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download Full doc Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download PDF EBOOK here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/v2xn3de } ......................................................................................................................... .........................................................................................................................
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier

R3.0.0 is relased

  1. 1. R.3.0.0 is released!!2013年4月20日第30回Tokyo.R@sfchaos
  2. 2. 2というわけで,2013年4月3日
  3. 3. 3R-3.0.0リリース!The R Project for Statistical Computing
  4. 4. 4いろめき立つR界隈R-statistics blogSOURCEFORGE.JP Magazine
  5. 5. 5何が変わったか?
  6. 6. 6@kohskeさんのページにまとまっているR.3.0.0の大事な変更点
  7. 7. 7大きな変更点Long Vectorの導入
  8. 8. 8Long Vectorとは長いベクトルのこと
  9. 9. 9> x <- rep(0, 2^31-1)> x <- rep(0, 2^31)エラー: サイズ 8.0 Gb のベクトルを割り当てることができません追加情報: 警告メッセージ:1: Reached total allocation of 16375Mb: see help(memory.size)2: Reached total allocation of 16375Mb: see help(memory.size)3: Reached total allocation of 16375Mb: see help(memory.size)4: Reached total allocation of 16375Mb: see help(memory.size)R-2.15.3までは1ベクトルのサイズは231-1まで(32ビット)※ベクトルだけでなく,配列や行列などのオブジェクトにも同じ制約あり
  10. 10. 10これがもっともっと長くなった※ただし,いろいろと微妙らしい前出の@kohskeさんのページ参照出典: Wikipedia 太陽系
  11. 11. 11その比なんと221(≒106.3)/* both config.h and Rconfig.h set SIZEOF_SIZE_T, but Rconfig.h isskipped if config.h has already been included. */#ifndef R_CONFIG_H# include <Rconfig.h>#endif#if ( SIZEOF_SIZE_T > 4 )# define LONG_VECTOR_SUPPORT#endif#ifdef LONG_VECTOR_SUPPORTtypedef ptrdiff_t R_xlen_t;typedef struct { R_xlen_t lv_length, lv_truelength; } R_long_vec_hdr_t;# define R_XLEN_T_MAX 4503599627370496# define R_SHORT_LEN_MAX 2147483647# define R_LONG_VEC_TOKEN -1252231-1
  12. 12. 12まさにマシマシ
  13. 13. 13コードも簡潔にchar *R_alloc(size_t nelem, int eltsize){R_size_t size = nelem * eltsize;double dsize = (double)nelem * eltsize;if (dsize > 0) { /* precaution against integeroverflow on 32-bit*/SEXP s;#if SIZEOF_SIZE_T > 4/* In this case by allocating larger units we canget up tosize(Rcomplex) * (2^31 - 1) bytes, approx 16Gb*/if(dsize < R_LEN_T_MAX)s = allocVector(RAWSXP, size + 1);else if(dsize < sizeof(double) * (R_LEN_T_MAX - 1))s = allocVector(REALSXP, (int)(0.99+dsize/sizeof(double)));else if(dsize < sizeof(Rcomplex) * (R_LEN_T_MAX -1))s = allocVector(CPLXSXP, (int)(0.99+dsize/sizeof(Rcomplex)));else {error(_("cannot allocate memory block of size%0.1f Gb"),dsize/1024.0/1024.0/1024.0);s = R_NilValue; /* -Wall */}#elseif(dsize > R_LEN_T_MAX) /* must be in the Gb range*/error(_("cannot allocate memory block of size%0.1f Gb"),dsize/1024.0/1024.0/1024.0);s = allocVector(RAWSXP, size + 1);#endifATTRIB(s) = R_VStack; R_VStack = s;return (char *) DATAPTR(s);}else return NULL;}char *R_alloc(size_t nelem, int eltsize){R_size_t size = nelem * eltsize;/* doubles are a precaution against integeroverflow on 32-bit */double dsize = (double) nelem * eltsize;if (dsize > 0) {SEXP s;#ifdef LONG_VECTOR_SUPPORT/* 64-bit platform: previous version used REALSXPs*/if(dsize > R_XLEN_T_MAX) /* currently 4096 TB */error(_("cannot allocate memory block of size%0.f Tb"),dsize/pow(1024.0, 4.0));s = allocVector(RAWSXP, size + 1);#elseif(dsize > R_LEN_T_MAX) /* must be in the Gb range*/error(_("cannot allocate memory block of size%0.1f Gb"),dsize/pow(1024.0, 3.0));s = allocVector(RAWSXP, size + 1);#endifATTRIB(s) = R_VStack;R_VStack = s;return (char *) DATAPTR(s);}/* One programmer has relied on this, but it isundocumented! */else return NULL;}src/main/memory.c(R.version.tar.gzを解凍)
  14. 14. 14あと,R.3.0.0ではパッケージを入れ直す必要があることに注意
  15. 15. 15以上!詳しくはこのあとの@wdkzさんのLTで
  16. 16. 16SEXP attribute_hidden do_Rprofmem(SEXP call, SEXP op, SEXP args, SEXP rho){SEXP filename;R_size_t threshold;int append_mode;checkArity(op, args);if (!isString(CAR(args)) || (LENGTH(CAR(args))) != 1)error(_("invalid %s argument"), "filename");append_mode = asLogical(CADR(args));filename = STRING_ELT(CAR(args), 0);threshold = REAL(CADDR(args))[0];if (strlen(CHAR(filename)))R_InitMemReporting(filename, append_mode, threshold);elseR_EndMemReporting();return R_NilValue;}#include "RBufferUtils.h"attribute_hiddenvoid *R_AllocStringBuffer(size_t blen, R_StringBuffer *buf){size_t blen1, bsize = buf->defaultSize;/* for backwards compatibility, probably no longer needed */if(blen == (size_t)-1) {warning("R_AllocStringBuffer(-1) used: please report");R_FreeStringBufferL(buf);return NULL;}if(blen * sizeof(char) < buf->bufsize) return buf->data;if(blen * sizeof(char) < buf->bufsize) return buf->data;blen1 = blen = (blen + 1) * sizeof(char);blen = (blen / bsize) * bsize;if(blen < blen1) blen += bsize;if(buf->data == NULL) {buf->data = (char *) malloc(blen);ところでソースコードが読みにくくないか?
  17. 17. 17読みやすいコード発見namespace CXXR {class String;template <typename, SEXPTYPE,typename Initializer = RObject::DoNothing> class FixedVector;typedef FixedVector<int, INTSXP> IntVector;typedef FixedVector<RHandle<>, VECSXP> ListVector;typedef FixedVector<RHandle<String>, STRSXP> StringVector;/** @brief Untemplated base class for R vectors.*/class VectorBase : public RObject {public:/*** @param stype The required ::SEXPTYPE.* @param sz The required number of elements in the vector.*/VectorBase(SEXPTYPE stype, std::size_t sz): RObject(stype), m_truelength(sz), m_size(sz){}/** @brief Copy constructor.** @param pattern VectorBase to be copied.*/VectorBase(const VectorBase& pattern): RObject(pattern), m_truelength(pattern.m_truelength),m_size(pattern.m_size){}クラスを用いてオブジェクト指向で記述
  18. 18. 18ドキュメントもある
  19. 19. 19その名はCXXRCXXR: Refactorising R into C++
  20. 20. 20#include <iostream>#include <fstream>#include <boost/noncopyable.hpp>class BigDataFrame : boost::noncopyable{public:enum DataType {CHAR=1, SHORT=2, INT=3, DOUBLE=4, COMPLEX=5};public:BigDataFrame(index_type nrow, index_type ncol) : nrow_(nrow), ncol_(ncol) {// initializing shared pointerp = std::shared_ptr<Monitor>(new Monitor[ncol],std::default_delete<Monitor[]>());Rの中身をC++で書き直すプロジェクト
  21. 21. 21useR!2009,2010等で発表されているProvenance Tracking in CXXR (useR!2009)CXXR and Add-on Packages(useR!2010)
  22. 22. 22おわコンかと思いきや最近の論文もCXXR: an extensible R interpreter
  23. 23. 23調査していつかどこかで紹介する(かも)

×