@@ -645,3 +645,45 @@ VALUE cmatrix_dense_eye(VALUE self, VALUE args)
645
645
cresult );
646
646
return result ;
647
647
}
648
+
649
+ VALUE cmatrix_sparse_get (VALUE self , VALUE r , VALUE c )
650
+ {
651
+ CDenseMatrix * this ;
652
+ Data_Get_Struct (self , CSparseMatrix , this );
653
+
654
+ basic_struct * cresult ;
655
+ VALUE result ;
656
+
657
+ unsigned long cbasic_r ;
658
+ cbasic_r = NUM2ULONG (r );
659
+ unsigned long cbasic_c ;
660
+ cbasic_c = NUM2ULONG (c );
661
+
662
+ cresult = basic_new_heap ();
663
+
664
+ sparse_matrix_get_basic (cresult , this , cbasic_r , cbasic_c );
665
+ result = Data_Wrap_Struct (Klass_of_Basic (cresult ), NULL , basic_free_heap ,
666
+ cresult );
667
+ return result ;
668
+ }
669
+
670
+ VALUE cmatrix_sparse_set (VALUE self , VALUE r , VALUE c , VALUE operand )
671
+ {
672
+ CSparseMatrix * this ;
673
+ Data_Get_Struct (self , CSparseMatrix , this );
674
+
675
+ basic cbasic_operand ;
676
+ basic_new_stack (cbasic_operand );
677
+ sympify (operand , cbasic_operand );
678
+
679
+ unsigned long cbasic_r ;
680
+ cbasic_r = NUM2ULONG (r );
681
+ unsigned long cbasic_c ;
682
+ cbasic_c = NUM2ULONG (c );
683
+
684
+ sparse_matrix_set_basic (this , cbasic_r , cbasic_c , cbasic_operand );
685
+
686
+ basic_free_stack (cbasic_operand );
687
+
688
+ return self ;
689
+ }
0 commit comments