Path: | rdoc/narray.rdoc |
Last Update: | Thu Feb 24 17:55:00 +0000 2011 |
Convert GSL objects to NArray. The data contained by the GSL objects are copied to a newly allocated memory block of the NArray objects created.
Create NArray-ref objects from GSL data. The memory block of the GSL objects are shared with the NArray-ref objects.
Example:
>> v = Vector::Int[0..5] => GSL::Vector::Int [ 0 1 2 3 4 5 ] >> na = v.to_nvector_ref => NVector(ref).int(6): [ 0, 1, 2, 3, 4, 5 ] >> na[3] = 999 => 999 >> v => GSL::Vector::Int [ 0 1 2 999 4 5 ]
NArray#to_gv converts NArray objects to GSL::Vector or GSL::Vector::Complex. NArray#to_gm converts NArray objects to GSL::Matrix. The data contained by the NArray objects are copied to a newly allocated memory block of the GSL objects created.
Create GSL::Vector::View or GSL::Matrix::View objects from NArray. The memory block of the NArray objects are shared with the View objects.
Example:
>> na = NArray[0, 1, 2, 3, 4, 5] => NArray.int(6): [ 0, 1, 2, 3, 4, 5 ] >> b = na.to_gv_int_view => GSL::Vector::Int::View [ 0 1 2 3 4 5 ] >> b[2] = -99 => -99 >> na => NArray.int(6): [ 0, 1, -99, 3, 4, 5 ]