<commit_before>/*
!!!!!!!!! Editing !!!!!!!!!!!

  lapack.c
  LAPACK wrapper for Ruby/Numo
    (C) Copyright 2017 by <NAME>

  This program is free software.
  NO WARRANTY.
*/
#include <assert.h>
#include <ruby.h>
#include "numo/narray.h"
#include "numo/template.h"

// from ruby/ext/fiddle/fiddle.h
#if defined(HAVE_DLFCN_H)
# include <dlfcn.h>
# /* some stranger systems may not define all of these */
#ifndef RTLD_LAZY
#define RTLD_LAZY 0
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif
#else
# if defined(_WIN32)
#   include <windows.h>
#   define dlopen(name,flag) ((void*)LoadLibrary(name))
#   define dlerror() strerror(rb_w32_map_errno(GetLastError()))
#   define dlsym(handle,name) ((void*)GetProcAddress((handle),(name)))
#   define RTLD_LAZY -1
#   define RTLD_NOW  -1
#   define RTLD_GLOBAL -1
# endif
#endif

#define lapack_complex_float scomplex
#define lapack_complex_double dcomplex
#include "lapacke.h"
#include "lapacke_t.h"

static void *lapack_handle = 0;
static char *lapack_prefix = 0;


int
numo_lapacke_option_order(VALUE trans)
{
    int opt;
    char *ptr;

    switch(TYPE(trans)) {
    case T_NIL:
    case T_FALSE:
        return LAPACK_ROW_MAJOR;
    case T_TRUE:
        return LAPACK_COL_MAJOR;
    case T_FIXNUM:
        opt = FIX2INT(trans);
        if (opt == LAPACK_ROW_MAJOR || opt == LAPACK_COL_MAJOR) {
            return opt;
        }
        break;
    case T_SYMBOL:
        trans = rb_sym2str(trans);
    case T_STRING:
        ptr = RSTRING_PTR(trans);
        if (RSTRING_LEN(trans) > 0) {
            switch(ptr[0]){
            case 'R': case 'r':
                return LAPACK_ROW_MAJOR;
            case 'C': case 'c':
                return LAPACK_COL_MAJOR;<commit_msg>fix variable<commit_after>/*
!!!!!!!!! Editing !!!!!!!!!!!

  lapack.c
  LAPACK wrapper for Ruby/Numo
    (C) Copyright 2017 by <NAME>

  This program is free software.
  NO WARRANTY.
*/
#include <assert.h>
#include <ruby.h>
#include "numo/narray.h"
#include "numo/template.h"

// from ruby/ext/fiddle/fiddle.h
#if defined(HAVE_DLFCN_H)
# include <dlfcn.h>
# /* some stranger systems may not define all of these */
#ifndef RTLD_LAZY
#define RTLD_LAZY 0
#endif
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif
#ifndef RTLD_NOW
#define RTLD_NOW 0
#endif
#else
# if defined(_WIN32)
#   include <windows.h>
#   define dlopen(name,flag) ((void*)LoadLibrary(name))
#   define dlerror() strerror(rb_w32_map_errno(GetLastError()))
#   define dlsym(handle,name) ((void*)GetProcAddress((handle),(name)))
#   define RTLD_LAZY -1
#   define RTLD_NOW  -1
#   define RTLD_GLOBAL -1
# endif
#endif

#define lapack_complex_float scomplex
#define lapack_complex_double dcomplex
#include "lapacke.h"
#include "lapacke_t.h"

static void *lapack_handle = 0;
static char *lapack_prefix = 0;


int
numo_lapacke_option_order(VALUE order)
{
    int opt;
    char *ptr;

    switch(TYPE(order)) {
    case T_NIL:
    case T_FALSE:
        return LAPACK_ROW_MAJOR;
    case T_TRUE:
        return LAPACK_COL_MAJOR;
    case T_FIXNUM:
        opt = FIX2INT(order);
        if (opt == LAPACK_ROW_MAJOR || opt == LAPACK_COL_MAJOR) {
            return opt;
        }
        break;
    case T_SYMBOL:
        order = rb_sym2str(order);
    case T_STRING:
        ptr = RSTRING_PTR(order);
        if (RSTRING_LEN(order) > 0) {
            switch(ptr[0]){
            case 'R': case 'r':
                return LAPACK_ROW_MAJOR;
            case 'C': case 'c':
                return LAPACK_COL_MAJOR;
{'fraction_non_alphanumeric': 0.12193056731583404, 'fraction_numerical': 0.011289867344058707, 'mean_word_length': 3.045662100456621, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2208827', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1302, 'n_words': 314}