Tài liệu trực tuyến Ruby / GSL cho phiên bản sai? (Ruby/GSL online documentation for wrong version?)


問題描述

Tài liệu trực tuyến Ruby / GSL cho phiên bản sai? (Ruby/GSL online documentation for wrong version?)

After successfuly installing Ruby/GSL library on my Debian (via *deb), with Ruby 1.9.3, I am having troubles running most of the GSL methods. Specifically, this webpage shows several code samples, but (in Arrays), right from the top line, require "GSL" is obsolete, it is require "gsl" today. The remaining methods also do not work.

For another example of my problem, consider another online reference to Ruby/GSL.

GSL::VERSION
#=> 1.15
GSL::pow_2( 4 )
#=> 16

But when I flip the page, 

GSL::Complex.new( 0.9, 1.1 )
#=> ArgumentError: wrong number of arguments(2 for 0)

The simplest explanation to me would be that Ruby/GSL has more than one version hanging online, and the documentation I found is for the old one. For example, there is this abandoned version (https://github.com/codahale/ruby‑gsl), so perhaps the version history is a bit complicated? Which is the authoritative version, and where can I finde the up‑to‑date documentation?


參考解法

方法 1:

Following methods do work for the Complex module:

> c = GSL::Complex[0.9, 1.1]
=> GSL::Complex
[ 9.000e‑01 1.100e+00 ]

> c.real
=> 0.9
> c.imag
=> 1.1

> c.pow 2
=> GSL::Complex
[ ‑4.000e‑01 1.980e+00 ]

(by Boris StitnickyDavid Unric)

參考文件

  1. Ruby/GSL online documentation for wrong version? (CC BY‑SA 3.0/4.0)

#Version #gsl #ruby






相關問題

XCode4 Organizer - 由於 CFBundleVersion 錯誤,應用程序驗證失敗 (XCode4 Organizer - App fails validation due to CFBundleVersion error)

如何避免編譯iOS 4.0提供的常量,並內置到iOS 3.1的設備中 (How to avoid compiling the constant which is provided in iOS 4.0, and build into the device with iOS 3.1)

如何從 CLI 中查找 php 中內置模塊的版本號 (how to find the version numbers of built in modules in php from the CLI)

Tài liệu trực tuyến Ruby / GSL cho phiên bản sai? (Ruby/GSL online documentation for wrong version?)

如何配置我的 SBT 以使用帶有指定插件的插件? (How to configure my SBT to use a plugin with a specified plugin?)

安裝舊版本的 Python 以在 Mac OS X 上進行測試 (Install older versions of Python for testing on Mac OS X)

檢測/指紋手機品牌和型號的替代方法? (Alternative way to detect/fingerprint phone make and model?)

實體框架發布揭秘 (Entity Framework Releases Demystified)

android SDK 版本之間的差異 (Difference between android SDK versions)

如何檢索顯示上游狀態的 git 版本信息 (How do I retrieve git version info showing upstream state)

嘗試使用 get-PnPFile 從 OneDrive 獲取文件的所有版本時找不到文件 (File not found trying to get all versions of a file from OneDrive using get-PnPFile)

獲取.Net Core 3.1 單文件可執行版本號 (Get .Net Core 3.1 single-file executable version number)







留言討論